First, cold backup
The process by which the database completes copies of all physical system files in the shutdown state, also known as offline backup
Suitable for non-archive mode, the database is in a consistent state
Second, the steps
First you get all the physical file locations that the database runs in the running library, and then close the database in the plan (shutdown)
To perform a copy of the physical home to the backup path or backup device
Start the database immediately after backup completes to provide normal service
Third, the writing of cold preparation script
First of all, should be in the relevant view of the database data files, log files, control files, temporary file location
Note: Do not direct the oradata under the CP on the line, because the production library in the various files are usually distributed in different disks, different places, so go to the view to get the real path
--View information about the instance and the database
Sql> select Instance_name,version,status,archiver,database_status from V$instance;
instance_name VERSION STATUS ARCHIVE database_status
---------------- ----------------- ------------ ------- -----------------
ORCL 10.2.0.1.0 OPEN STOPPED ACTIVE
Sql> select Dbid,name,log_mode from V$database;
DBID NAME Log_mode
---------- --------- ------------
1242732291 ORCL Noarchivelog
--View data files and status information
Sql> select File_name,tablespace_name,status,online_status from Dba_data_files;
file_name tablespace STATUS Online_
------------------------------------------------------- ---------- --------- -------
/U01/APP/ORACLE/ORADATA/ORCL/UNDOTBS01.DBF UNDOTBS1 AVAILABLE ONLINE
/U01/APP/ORACLE/ORADATA/ORCL/SYSTEM01.DBF System AVAILABLE System
/U01/APP/ORACLE/ORADATA/ORCL/SYSAUX01.DBF Sysaux AVAILABLE ONLINE
/U01/APP/ORACLE/ORADATA/ORCL/USERS01.DBF USERS AVAILABLE ONLINE
/U01/APP/ORACLE/ORADATA/ORCL/EXAMPLE01.DBF EXAMPLE AVAILABLE ONLINE
/U01/APP/ORACLE/ORADATA/ORCL/TBS1_1.DBF TBS1 AVAILABLE ONLINE
/U01/APP/ORACLE/ORADATA/ORCL/TBS1_2.DBF TBS1 AVAILABLE ONLINE
--View data files
Sql> select name from V$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/example01.dbf
/u01/app/oracle/oradata/orcl/tbs1_1.dbf
/u01/app/oracle/oradata/orcl/tbs1_2.dbf
--View Temporary files
Sql> select name from V$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/temp01.dbf
--View Log files
Sql> Select member from V$logfile;
Member
------------------------------------------------------------
/u01/app/oracle/oradata/orcl/redo2a.rdo
/u01/app/oracle/oradata/orcl/redo2b.rdo
/u01/app/oracle/oradata/orcl/redo1a.rdo
/u01/app/oracle/oradata/orcl/redo3a.rdo
/u01/app/oracle/oradata/orcl/redo3b.rdo
/u01/app/oracle/oradata/orcl/redo1b.rdo
--View Control files
Sql> select name from V$controlfile;
NAME
------------------------------------------------------------
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/oradata/orcl/control02.ctl
--Create a backup directory
Sql> Ho Mkdir/u01/app/oracle/coolbak
--use connectors to generate copy file commands
sql> Select ' Ho cp ' | | name | | '/u01/app/oracle/coolbak ' from V$controlfile;
' HOCP ' | | name| | ' /u01/app/oracle/coolbak '
----------------------------------------------------------------------------------
Ho Cp/u01/app/oracle/oradata/orcl/control01.ctl/u01/app/oracle/coolbak
Ho Cp/u01/app/oracle/oradata/orcl/control02.ctl/u01/app/oracle/coolbak
Sql> Save/tmp/tmpbak.sql; --Save the above input as Tmpbak.sql
Created File/tmp/tmpbak.sql
Sql> Ho Vim/tmp/tmpbak.sql-Edit Tmpbak.sql, enter the following content into Tmpbak.sql
Set Feedback off
Set Heading off
Set Verify off
Set Trimspool off
Set pagesize 0
Set Linesize 200
Define DIR = '/u01/app/oracle/coolbak '
Define script = '/tmp/coolbak.sql '
Spool &script
Select ' Ho cp ' | | name | | ' &dir ' from V$controlfile
UNION ALL
Select ' Ho cp ' | | name | | ' &dir ' from V$datafile
UNION ALL
Select ' Ho cp ' | | Member | | ' &dir ' from V$logfile
UNION ALL
Select ' Ho cp ' | | name | | ' &dir ' from V$tempfile
/
Create pfile = ' &dir/initorcl.ora ' from SPFile;
Ho CP/U01/APP/ORACLE/10G/DBS/ORAPWORCL &dir
Spool off
Shutdown immediate
Start &script
Ho RM &script
Startup
--Executive Tmpbak.sql
Sql> @/tmp/tmpbak.sql;
--Implementation process and database startup slightly
--View backed up files after startup
Sql> Ho Ls/u01/app/oracle/coolbak
Control01.ctl ORAPWORCL Redo2b.rdo system01.dbf users01.dbf
Control02.ctl Redo1a.rdo Redo3a.rdo tbs1_1.dbf
EXAMPLE01.DBF Redo1b.rdo Redo3b.rdo tbs1_2.dbf
Initorcl.ora Redo2a.rdo sysaux01.dbf undotbs01.dbf
Iv. Summary
Advantages
The concept is easy to understand in cold standby mode, and the files that need to be backed up will be copied to a secure location
Easy to operate without too much intervention
Easy to recover to a point in time (just copy the file back)
Can be combined with the archiving method to restore the "latest state" of the database.
Disadvantages
Database must be in a consistent shutdown state when backing up
can only provide recovery to a point in time
Backup time is slow, especially the large amount of data performance impact relatively large
Cannot implement data recovery based on table and user level