Search This Blog

Monday, 17 April 2023

Drop DB & Restore From Full Backup

 

Drop DB & Restore From Full Backup

SQL> startup nomount pfile='/dbbkup01-oracle/oracle_12c_rman_backup/pfile_before.ora';

            

SQL> STARTUP FORCE MOUNT;

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

ORACLE instance started.


Total System Global Area 2147483648 bytes

Fixed Size                  3712904 bytes

Variable Size            1409288312 bytes

Database Buffers          721420288 bytes

Redo Buffers               13062144 bytes

Database mounted.


SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;


System altered.


SQL> drop database;


Database dropped.


SQL> exit


sqlplus / as sysdba


export ORACLE_HOME=/dboracle-oracle/12.2.0.1

 export ORACLE_BASE=/dboracle-oracle

 export TNS_ADMIN=/dboracle-oracle/12.2.0.1/network/admin

 export LD_LIBRARY_PATH=$ORACLE_HOME/lib

 export LD_LIBRARY_PATH=$ORACLE_HOME/lib

 export PATH=$ORACLE_HOME/bin:$PATH

export PATH=/dboracle-oracle/12.2.0.1/OPatch:$PATH

export ORACLE_SID=oracle


SQL> startup nomount pfile='/dbbkup01-oracle/oracle_12c_rman_backup/pfile_before.ora';

 rman target /


Recovery Manager: Release 12.1.0.2.0 - Production on Fri Jul 29 10:57:58 2022


Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.


connected to target database: oracle (not mounted)


RMAN> restore controlfile from '/dbbkup01-oracle/oracle_12c_rman_backup/controlc-3906095509-20230330-00.rman';


RMAN> alter database mount;



crosscheck backup;

delete expired backup;

crosscheck archivelog all;

delete expired archivelog all;


RMAN> catalog start with '/dbbkup01-oracle/oracle_12c_rman_backup';


searching for all files that match the pattern /dbbkup01-oracle/oracle_12c_rman_backup


List of Files Unknown to the Database

=====================================

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/oracle1122978339_10_1

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/users_backup.sql

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/oracle1122978338_6_1

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/rman.log

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/before_control.trc

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/pfile_before.ora

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/precheck.log

File Name: /dbbkup01-oracle/oracle_12c_rman_backup/oracle1122978339_9_1


Do you really want to catalog the above files (enter YES or NO)? YES


  vi restore.rcv

  

run {

allocate channel c1 device type disk;

allocate channel c2 device type disk;

allocate channel c3 device type disk;

allocate channel c4 device type disk;

allocate channel c5 device type disk;

allocate channel c6 device type disk;

restore database;

switch datafile all;

switch tempfile all;

recover database;

alter database open resetlogs;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

release channel c5;

release channel c6;

}  

    nohup rman target / @restore.rcv > restore.log &

OR   


RMAN>restore database;

                                   

RMAN>recover database;




RMAN>alter database open resetlogs;


***************************


SQL> select * from v$recover_file; (It shows any corrupted files are there or not)


no rows selected


SQL> alter system switch logfile;


System altered.


SQL> alter system checkpoint;


System altered.


SQL>


create spfile from pfile='/dbbkup01-oracle/oracle_12c_rman_backup/pfile_before.ora';


Shut immediate;

Startup;


SQL> show parameter spfile


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      /dboracle-oracle/12.1.0.2/dbs/s

                                                 pfileoracle.ora


No comments:

Post a Comment