Tuesday, August 17, 2021

Oracle Cold Backup

 

Cold backup.

Step 1—Generating File List

Data files

Control files

Init.ora 

 

V$datafile Lists all the data files used in the database

SQL> select name from v$datafile;

 

NAME

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

/u01/app/oracle/oradata/ORACLE/datafile/o1_mf_system_jhobsyhf_.dbf

/u01/app/oracle/oradata/ORACLE/datafile/o1_mf_sysaux_jhobvcxq_.dbf

/u01/app/oracle/oradata/ORACLE/datafile/o1_mf_undotbs1_jhobw56w_.dbf

/u01/app/oracle/oradata/ORACLE/datafile/tspace.dbf

/u01/app/oracle/oradata/ORACLE/datafile/o1_mf_users_jhobw6bc_.dbf

Backup the control file and perform a trace of the control file using

SQL>alter database backup controlfile to '/u03/colbkp/control.ctl';

SQL> select name from v$controlfile;

 

NAME

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

/u01/app/oracle/oradata/ORACLE/controlfile/control2.ctl

 

SQL> select member from v$logfile;

 

MEMBER

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

/u01/app/oracle/oradata/ORACLE/onlinelog/redo3.log

/u01/app/oracle/fast_recovery_area/ORACLE/onlinelog/redo3.log

/u01/app/oracle/oradata/ORACLE/onlinelog/redo1.log

/u01/app/oracle/fast_recovery_area/ORACLE/onlinelog/redo2.log

/u01/app/oracle/oradata/ORACLE/onlinelog/redo2.log

/u01/app/oracle/fast_recovery_area/ORACLE/onlinelog/redo1.log

 

Step 2—Shut down the database

SQL> shut immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

Step 3- create a new folder using mkdir to save the backup files in this location

 

[oracle@oracle ~]$ mkdir u03

[oracle@oracle ~]$ cd u03/

[oracle@oracle u03]$ mkdir coldbackup

 

 

Step 4—Perform a backup

In the first step, you generated a list of files to be backed up. To back up the files, you can use the Unix copy command (cp) to copy it to a backup location, as shown in the following code. You have to copy all files that you generated in Step 1.

[oracle@oracle u03]$ cd coldbackup/

[oracle@oracle coldbackup]$ cd

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/datafile/o1_mf_system_jhobsyhf_.dbf u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/datafile/o1_mf_sysaux_jhobvcxq_.dbf u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/datafile/o1_mf_undotbs1_jhobw56w_.dbf u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/datafile/tspace.dbf u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/datafile/o1_mf_users_jhobw6bc_.dbf u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/controlfile/control2.ctl u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/onlinelog/redo3.log u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/fast_recovery_area/ORACLE/onlinelog/redo3.log u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/onlinelog/redo1.log u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/fast_recovery_area/ORACLE/onlinelog/redo2.log u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/oradata/ORACLE/onlinelog/redo2.log u03/coldbackup/

[oracle@oracle ~]$ cp /u01/app/oracle/fast_recovery_area/ORACLE/onlinelog/redo1.log u03/coldbackup/

 

Step 5—Start the database

After the backup is complete, you can start the database as follows:

[oracle@oracle ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Aug 9 23:00:00 2021

Version 19.3.0.0.0

 

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SQL> startup

ORACLE instance started.

 

Total System Global Area 1543500144 bytes

Fixed Size                       8896880 bytes

Variable Size                 989855744 bytes

Database Buffers          536870912 bytes

Redo Buffers                  7876608 bytes

Database mounted.

Database opened.

SQL> alter database backup controlfile to trace;

 

Database altered.

 

SQL> select name from v$database;

 

NAME

---------

ORACLE

 

 

 

No comments:

Post a Comment

Auto Shutdown and Restart of Oracle DB Systems in OCI Using Functions

  🔹 Introduction Oracle Cloud Infrastructure (OCI) Database Systems incur compute costs even when idle. If you're running non-producti...