In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to understand incarnation in rman, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
Incarnation means "avatar" in English.
So what does it mean in oracle? What's the use?
Let's look at some basic concepts.
Current Incarnation (current avatar): the avatar currently in use in the database.
Parent Incarnation (parent avatar): the last avatar of the current avatar in the database. When the parent avatar is turned on as OPEN RESETLOGS, the current avatar is generated.
Ancestor Incarnation (ancestral incarnation): before the father incarnates, tossing and turning to generate the incarnation of the father.
Direct Ancestral Path (direct ancestral path / genealogy): the branch path generated from the initial avatar of the database to the current avatar, including the ancestral and parent avatars of the database.
Orphan Incarnation (orphan avatar): other database avatars that are not on the genealogy of the current incarnation in the database.
Orphaned Backups (orphan backup): a database backup that is not generated on the genealogy of the current avatar of the database. The current avatar cannot make
First of all, we can look at a picture to have a basic understanding of incarnation.
As shown in the figure, in the process from SCN1 to SCN1000, the database belongs to incarnation 1, which develops to horizontal SCN2000, and does not completely recover to SCN1000. At this time, SCN1000 goes to horizontal SCN2000 (orphan incarnation). And SCN1000 develops to the above SCN2000 to form incarnation 2. Incarnation 1 is the parent incarnation of incarnation 2.
When SCN2000 continues to develop to SCN3000, it does not completely recover to SCN2000,SCN2000 and continues to develop horizontally to SCN3000, forming incarnation 3. So incarnation 1 is the embodiment of incarnation 3, and incarnation 2 is the embodiment of incarnation 1.
The gray track for all incarnation 1 to incarnation 3 is Direct Ancestral Path.
All backups after SCN 1000 in Incarnation 1 and all backups after SCN 2000 in Incarnation 2 are orphan backups.
From then on, I should be able to get a general understanding of Incarnation.
Let's learn about it through experiments.
RMAN > backup as compressed backupset database plus archivelog delete all input
RMAN > list incarnation
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
-
11 ORCL 1446008355 PARENT 1 18-SEP-11
2 2 ORCL 1446008355 PARENT 787897 26-JUL-16
3 3 ORCL 1446008355 PARENT 885125 03-AUG-16
44 ORCL 1446008355 PARENT 886406 13-AUG-16
55 ORCL 1446008355 CURRENT 906785 15-AUG-16
[oracle@linfan ~] $sqlplus / as sysdba
SQL > grant dba to scott
Grant succeeded.
SQL > begin
For i in 1.. 10 loop
Insert into test select current_scn from v$database
Commit
End loop
End; 2 3 4 5 6
7 /
SQL > select * from test
CUR_SCN
-
1400123
1400126
1400129
1400132
1400135
1400138
1400141
1400144
1400147
1400150
10 rows selected.
Rman target /
RMAN > run {
Startup mount force
Set until scn 1400138
Restore database
Recover database
Alter database open resetlogs
}
Check the data and find that the restore was successful.
SQL > select * from test
CUR_SCN
-
1400123
1400126
1400129
1400132
1400135
View the following incarnation
RMAN > list incarnation
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
-
11 ORCL 1446008355 PARENT 1 18-SEP-11
2 2 ORCL 1446008355 PARENT 787897 26-JUL-16
3 3 ORCL 1446008355 PARENT 885125 03-AUG-16
44 ORCL 1446008355 PARENT 886406 13-AUG-16
55 ORCL 1446008355 PARENT 906785 15-AUG-16
6 6 ORCL 1446008355 CURRENT 1400139 05-DEC-16
It is found that the incarnation,5 with DB 6 has become PARENT.
Execute the previous stored procedure again
SQL > select * from test
CUR_SCN
-
1400123
1400126
1400129
1400132
1400135
1400972
1400975
1400978
1400981
1400984
1400987
CUR_SCN
-
1400990
1400993
1400995
1400999
15 rows selected.
Do an incomplete recovery again
RMAN > run {
Startup mount force
Set until scn 1400990
Restore database
Recover database
Alter database open resetlogs
}
The recovery is successful, and the incarnation with DB 7 is evolved.
RMAN > list incarnation
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
-
11 ORCL 1446008355 PARENT 1 18-SEP-11
2 2 ORCL 1446008355 PARENT 787897 26-JUL-16
3 3 ORCL 1446008355 PARENT 885125 03-AUG-16
44 ORCL 1446008355 PARENT 886406 13-AUG-16
55 ORCL 1446008355 PARENT 906785 15-AUG-16
6 6 ORCL 1446008355 PARENT 1400139 05-DEC-16
7 7 ORCL 1446008355 CURRENT 1400991 05-DEC-16
View the test table
SQL > select * from test
CUR_SCN
-
1400123
1400126
1400129
1400132
1400135
1400972
1400975
1400978
1400981
1400984
1400987
11 rows selected.
At this point, can we achieve it if we want to return to the state of 1400132?
Note: 1400132 is the SCN under incarnation with DB 5
RMAN > run {
Startup mount force
Set until scn 1400132
Restore database
Recover database
Alter database open resetlogs
}
Unfortunately, RMAN-20208 's error was exposed.
Starting restore at 05-DEC-16
Using target database control file instead of recovery catalog
RMAN-00571: =
RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =
RMAN-00571: =
RMAN-03002: failure of restore command at 12/05/2016 17:10:14
RMAN-20208: UNTIL CHANGE is before RESETLOGS change
So how to solve the mistake of RMAN-20208?
To go back to the incarnation with a DB of 5, and then restore
RMAN > reset database to incarnation 5
Database reset to incarnation 5
RMAN > run {
Startup mount force
Set until scn 1400132
Restore database
Recover database
Alter database open resetlogs
}
RMAN > list incarnation
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
-
11 ORCL 1446008355 PARENT 1 18-SEP-11
2 2 ORCL 1446008355 PARENT 787897 26-JUL-16
3 3 ORCL 1446008355 PARENT 885125 03-AUG-16
44 ORCL 1446008355 PARENT 886406 13-AUG-16
55 ORCL 1446008355 PARENT 906785 15-AUG-16
8 8 ORCL 1446008355 CURRENT 1400133 05-DEC-16
6 6 ORCL 1446008355 ORPHAN 1400139 05-DEC-16
7 7 ORCL 1446008355 ORPHAN 1400991 05-DEC-16
SQL > select * from test
CUR_SCN
-
1400123
1400126
1400129
Thus it can be seen that the data has been restored to the previous state, the avatar with DB 8 has been evolved, the avatar with DB 6 and 7 has become an orphan avatar (ORPHAN), and the database has been restored successfully.
Summary: if you want to restore to the previous scn of incarnation, you need to switch to the previous incarnation.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.