Saturday, April 18, 2020

RMAN Recovery From Missing All Control Files 19c

RMAN Recovery From Missing All Control File

Note down DBID
[code] SQL> select dbid from v$database; DBID ---------- 1414679838 [oracle@orcl19c ORCL1]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Sat Apr 18 22:49:51 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL1 (DBID=1414679838) RMAN> select name from v$database; using target database control file instead of recovery catalog NAME --------- ORCL1 [/code]


Check RMAN configuration
[code] RMAN> show all; RMAN configuration parameters for database with db_unique_name ORCL1 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/snapcf_orcl1.f'; # default [/code]


Verify CONTROLFILE AUTOBACKUP ON or OFF
If OFF enable using following command

[code] RMAN> configure controlfile autobackup on; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored [/code]


Take database backup using following command
[code] RMAN> backup database; Starting backup at 18-APR-20 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=26 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00015 name=/u01/app/oracle/oradata/ORCL1/encrypt_test.dbf input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL1/system01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL1/sysaux01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL1/undotbs01.dbf input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL1/users01.dbf input datafile file number=00013 name=/u01/app/oracle/oradata/OGG/datafile/gg_cdb.dbf channel ORA_DISK_1: starting piece 1 at 18-APR-20 channel ORA_DISK_1: finished piece 1 at 18-APR-20 piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/01uu01kj_1_1 tag=TAG20200418T225202 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00010 name=/u01/app/oracle/oradata/ORCL1/orcl1pdb/sysaux01.dbf input datafile file number=00009 name=/u01/app/oracle/oradata/ORCL1/orcl1pdb/system01.dbf input datafile file number=00011 name=/u01/app/oracle/oradata/ORCL1/orcl1pdb/undotbs01.dbf input datafile file number=00012 name=/u01/app/oracle/oradata/ORCL1/orcl1pdb/users01.dbf input datafile file number=00014 name=/u01/app/oracle/oradata/OGG/datafile/gg_pdb1.dbf channel ORA_DISK_1: starting piece 1 at 18-APR-20 channel ORA_DISK_1: finished piece 1 at 18-APR-20 piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/02uu01kq_1_1 tag=TAG20200418T225202 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00006 name=/u01/app/oracle/oradata/ORCL1/pdbseed/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/ORCL1/pdbseed/system01.dbf input datafile file number=00008 name=/u01/app/oracle/oradata/ORCL1/pdbseed/undotbs01.dbf channel ORA_DISK_1: starting piece 1 at 18-APR-20 channel ORA_DISK_1: finished piece 1 at 18-APR-20 piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/03uu01kt_1_1 tag=TAG20200418T225202 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 18-APR-20 Starting Control File and SPFILE Autobackup at 18-APR-20 piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/c-1414679838-20200418-00 comment=NONE Finished Control File and SPFILE Autobackup at 18-APR-20 [/code]

Check the Control file location
[code] SQL> select name from v$controlfile; NAME --------------------------------------------- /u01/app/oracle/oradata/ORCL1/control01.ctl /u01/app/oracle/oradata/ORCL1/control02.ctl [/code]

Shutdown database and delete control files
[code] [oracle@orcl19c ORCL1]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sat Apr 18 22:55:28 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> shut immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> quit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 [oracle@orcl19c suh_test]$ rm -rf /u01/app/oracle/oradata/ORCL1/control01.ctl [oracle@orcl19c suh_test]$ rm -rf /u01/app/oracle/oradata/ORCL1/control02.ctl [/code]

Try to start the database
[code] SQL> startup ORACLE instance started. Total System Global Area 893385440 bytes Fixed Size 9140960 bytes Variable Size 234881024 bytes Database Buffers 641728512 bytes Redo Buffers 7634944 bytes ORA-00205: error in identifying control file, check alert log for more info [/code]

Recover the control file using RMAN
[code] [oracle@orcl19c ~]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Sat Apr 18 22:57:25 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL1 (not mounted) RMAN> set dbid 1414679838 executing command: SET DBID RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP; Starting restore at 18-APR-20 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=330 device type=DISK channel ORA_DISK_1: looking for AUTOBACKUP on day: 20200418 channel ORA_DISK_1: AUTOBACKUP found: c-1414679838-20200418-00 channel ORA_DISK_1: restoring control file from AUTOBACKUP c-1414679838-20200418-00 channel ORA_DISK_1: control file restore from AUTOBACKUP complete output file name=/u01/app/oracle/oradata/ORCL1/control01.ctl output file name=/u01/app/oracle/oradata/ORCL1/control02.ctl Finished restore at 18-APR-20 RMAN> ALTER DATABASE MOUNT; released channel: ORA_DISK_1 Statement processed RMAN> RESTORE DATABASE; Starting restore at 18-APR-20 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=330 device type=DISK skipping datafile 5; already restored to file /u01/app/oracle/oradata/ORCL1/pdbseed/system01.dbf skipping datafile 6; already restored to file /u01/app/oracle/oradata/ORCL1/pdbseed/sysaux01.dbf skipping datafile 8; already restored to file /u01/app/oracle/oradata/ORCL1/pdbseed/undotbs01.dbf skipping datafile 9; already restored to file /u01/app/oracle/oradata/ORCL1/orcl1pdb/system01.dbf skipping datafile 10; already restored to file /u01/app/oracle/oradata/ORCL1/orcl1pdb/sysaux01.dbf skipping datafile 11; already restored to file /u01/app/oracle/oradata/ORCL1/orcl1pdb/undotbs01.dbf skipping datafile 12; already restored to file /u01/app/oracle/oradata/ORCL1/orcl1pdb/users01.dbf skipping datafile 14; already restored to file /u01/app/oracle/oradata/OGG/datafile/gg_pdb1.dbf channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ORCL1/system01.dbf channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORCL1/sysaux01.dbf channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORCL1/undotbs01.dbf channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/ORCL1/users01.dbf channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/OGG/datafile/gg_cdb.dbf channel ORA_DISK_1: restoring datafile 00015 to /u01/app/oracle/oradata/ORCL1/encrypt_test.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/19.0.0/dbhome_1/dbs/01uu01kj_1_1 channel ORA_DISK_1: piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/01uu01kj_1_1 tag=TAG20200418T225202 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 Finished restore at 18-APR-20 RMAN> RECOVER DATABASE; Starting recover at 18-APR-20 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 11 is already on disk as file /u01/app/oracle/oradata/ORCL1/redo02.log archived log file name=/u01/app/oracle/oradata/ORCL1/redo02.log thread=1 sequence=11 media recovery complete, elapsed time: 00:00:00 Finished recover at 18-APR-20 RMAN> ALTER DATABASE OPEN RESETLOGS; Statement processed RMAN> QUIT Recovery Manager complete. [/code]

Check the status
[code] SQL> select status from v$instance; STATUS ------------ OPEN SQL> select name from v$database; NAME --------- ORCL1 [/code]

No comments:

Post a Comment