2014-08-10 Baoxinjian
I. Summary
Second, cold backup
--======================
--Oracle Cold backup
--======================
One, cold backup
The process of completing all physical system file copies in a closed state, also known as offline backup
Suitable for non-archive mode, the database is in a consistent state
Second, step
Start by getting all the physical file locations of the database running in the running library, and then shutting down the database (shutdown) within the plan
Perform a copy of the physical home to the backup path or backup device
Start the database immediately after the backup is complete to provide normal service
Three, cold preparation script
First, you should find out the database data files, log files, control files, and the location of the temporary files in the relevant view.
Note: Do not direct the oradata under the CP on the line, because the production library files are usually distributed in different disks, different places, so in the view to get the real path
--View information about instances and databases
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
--using the connector to generate the copy File command
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 into the 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;
--Execution process and database start-up slightly
--View the 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 will need to be backed up are copied to a secure location
Simple operation, no need for 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 database "up-to-date state".
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 performance impact of data volume is relatively large
Cannot implement table-and user-level data recovery
Abalone New ********************
Dba_oracle Cold Backup Case Script this method (case)