In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I. Test environment
The database version is 11GR2. After making a full backup, shut down the computer, take a snapshot, and execute alter system switch logfile several times after each boot to generate archive logs.
Subsequent tests are based on such a full backup.
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO'/ backup/%F'
Backup incremental level 0 format'/ backup/%T_%f' database
II. Testing of missing data files
2.1 Test of missing all data files
1. Start the database to mount state
Startup mount
two。 Start RMAN
[oracle@mycentos orcl] $rman target /
3. Restore database
RMAN > restore database
4. Restore the database
RMAN > recover database
After the restore is complete, check to see if the status of each file is normal.
Select file_name,file_id,status from dba_data_files
-- View temporary tablespace files
Select status,enabled, name, bytes/1024/1024 file_size
From v$tempfile
Select file_name from dba_temp_files
2.2 Test of missing a single data file
2.2.1 missing non-critical data files
Take, for example, the missing data file'/ u01ax _ name _ _ oracle_
1) alter database datafile'/u01/app/oracle/oradata/orcl/users01.dbf' offline
2) restore/recover data file in RMAN mode
Restore datafile'/ u01qqapp.oracle.oradataUnitedUsers01.dbf'
Recover datafile'/ u01qqapp.oracle.oradataUnitedUsers01.dbf'
3) the data file is online
Alter database datafile'/u01/app/oracle/oradata/orcl/users01.dbf' online
When the database crashes unexpectedly:
[oracle@mycentos ~] $sqlplus / nolog
SQL > conn / as sysdba
SQL > startup
ORA-01157: cannot identify/lock data file 4-see DBWR trace file
ORA-01110: data file 4:'/ u01 *
-- you can directly start to mount state first.
Start RMAN:
Restore datafile'/ u01qqapp.oracle.oradataUnitedUsers01.dbf'
Recover datafile'/ u01qqapp.oracle.oradataUnitedUsers01.dbf'
Alter database datafile'/u01/app/oracle/oradata/orcl/users01.dbf' online
Alter database open
After the non-critical data file is lost, first make the data file in the offline state, and then transfer it to the online state after recovering the data file.
2.2.2 critical data files are missing
[oracle@mycentos orcl] $rm system01.dbf
After shutting down the database, the process is the same as recovering data non-critical data files after a crash.
III. Testing of missing log files
The current configuration is that all group have only one member, add a new member to the group1 to make it two members, and the other group still has only one member.
3.1 recovery test of missing inactive log files
Delete the second log group and simulate a database crash
The database can continue to run without shutdown, but there will be an alarm in the log file.
Shutdown abort
Startup mount
Alter database clear unarchived logfile group 2; # this command rebuilds the second set of log files
Alter database open
Delete a member of the first group of logs:
Rm redo01.log
Shutdown abort
Startup
The database can be opened normally. The state of redo01.log becomes INVALID.
Use alter database clear unarchived logfile group 1; rebuild the log file
3.2 recovery Test of missing CURRENT Log Files
When the first group is CURRENT or actives, delete a member of the first set of logs and the database can be opened normally.
When the third group is CURRENT and there is only one member, delete the log of the third group.
The startup command reports an error and will report when clear unarchived logfile is executed
ORA-01624: error for log 3 needed for crash recovery of instance orcl (thread 1).
Alter database open;# will report ORA-00313 's error.
Therefore, you need to open the database in other ways:
Method 1: use incomplete recovery:
RMAN > RESTORE DATABASE
For RMAN > RECOVER DATABASE UNTIL TIME 'SYSDATE-5/1440';#, you can see the time when the archive log is generated.
SQL > alter database open resetlogs
Method 2: use incomplete recovery directly without RMAN.
SQL > alter system set "_ allow_resetlogs_corruption" = true scope=spfile
SQL > shutdown abort
SQL > startup mount
SQL > recover database until cancel
SQL > alter database open resetlogs
3.3 Archive log files are lost and the database needs to be restored.
Incomplete recovery to a certain point in time using RMAN.
3.4 Test with loss of all online redo log files
Recovery Test with reference to missing CURRENT Log Files
Fourth, the test of missing control files
4.1 when there are multiple copies of the control file, delete one of the control files to simulate a database crash.
When the database is closed, the database can be opened normally by copying the copy to the name of the deleted control file.
4.2 all members of the control file are lost, and the simulation database crashes
4.2.1 where there are backup control files, use the backup control files to restore the database.
SQL > startup nomount
RMAN > set dbid 144367883 can view backup control files to get DBID
RMAN > restore controlfile from'/ backup/c-1443678834-20160723-00'
SQL > alter system set "_ allow_resetlogs_corruption" = true scope=spfile
SQL > shutdown abort
SQL > startup mount
SQL > recover database using backup controlfile until cancel
# enter AUTO. After applying the archive log, enter recover database., and enter the path + name of online redo.
SQL > alter database open resetlogs;# data will not be lost
# rebuild temporary tablespaces if necessary
# ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 SIZE
4.2.2 if there are no backed up control files, you need to rebuild the control files.
Before deleting the control file, get the creation statement of the control file:
1) alter database backup controlfile to trace as'/ home/oracle/crontol_trace.trc'
2) obtain the following statement from the / home/oracle/crontol_trace.trc file:
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1'/ u01 BLOCKSIZE SIZE BLOCKSIZE 50m oradata
GROUP 2'/ u01 SIZE SIZE 50m oradata BLOCKSIZE 512
GROUP 3'/ u01 SIZE SIZE BLOCKSIZE 512
GROUP 4'/ u01 SIZE SIZE BLOCKSIZE 50m oradata
DATAFILE
'/ u01 apprenticeship oracleplains oradata'orclplets system01.dbf'
'/ u01 apprenticeship oracleandoradata 'sysaux01.dbf'
'/ u01 apprenticeship oradata' undotbs01.dbf'
'/ u01 apprenticeship oracleandoradata 'users01.dbf'
'/ u01 apprenticeship oracleandoradataUniplicateorclinced01.dbf'
'/ u01 apprenticeship oracleandoradataUniplicateorclUniples02.dbf'
CHARACTER SET ZHS16GBK
If you do not use the statement in 1) to get the creation statement, you can also rebuild the control file according to the actual situation.
Delete all control files and simulate a database crash.
The recovery process is as follows:
1) startup nomount
2) execute the statement to create the control file, copy the statement directly or put it in the script.
3) execute after:
SQL > alter system set "_ allow_resetlogs_corruption" = true scope=spfile
SQL > shutdown abort
SQL > startup mount
SQL > recover database using backup controlfile until cancel
# enter AUTO. After applying the archive log, enter recover database., and enter the path + name of online redo.
SQL > alter database open resetlogs;# data will not be lost
Rebuild temporary tablespace
ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 SIZE SIZE
Open the database after only one backup and the rest of the files are lost
After the database crash:
1) start the database to nomount, open RMAN and set dbid
SQL > startup nomount
RMAN > set dbid 1443678834
2) restore control files
RMAN > restore controlfile from'/ backup/c-1443678834-20160723-00'
SQL > alter database mount
3) restore data files
RMAN > restore database
4) perform an incomplete recovery:
SQL > alter system set "_ allow_resetlogs_corruption" = true scope=spfile
SQL > shutdown abort
SQL > startup mount
SQL > recover database using backup controlfile until cancel
Because the log files and archive log files have been deleted, select cancel to not perform the restore.
SQL > alter database open resetlogs
Then check whether the files are normal or not.
VI. Summary
From the process of simulating online log files and controlling the loss of files, it can be found that when these files have copies, the database can be opened quickly, thus reducing the difficulty of restoring the database.
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.