第十二章: BACKUP and RECOVERY (数据备份和恢复)
1. v$sga,v$instance,v$process,v$bgprocess,v$database,v$datafile,v$sgastat
2. Rman need set dbwr_IO_slaves or backup_tape_IO_slaves and large_pool_size
3. Monitoring Parallel Rollback
> v$fast_start_servers , v$fast_start_transactions
4.perform a closed database backup (noarchivelog)
> shutdown immediate
> cp files /backup/
> startup
5.restore to a different location
> connect system/manager as sysdba
> startup mount
> alter database rename file '/disk1/../user.dbf' to '/disk2/../user.dbf';
> alter database open;
6.recover syntax
--recover a mounted database
>recover database;
>recover datafile '/disk1/data/df2.dbf';
>alter database recover database;
--recover an opened database
>recover tablespace user_data;
>recover datafile 2;
>alter database recover datafile 2;
7.how to apply redo log files automatically
>set autorecovery on
>recover automatic datafile 4;
8.complete recovery:
--method 1(mounted databae)
>copy c:\backup\user.dbf c:\oradata\user.dbf
>startup mount
>recover datafile 'c:\oradata\user.dbf;
>alter database open;
--method 2(opened database,initially opened,not system or rollback datafile)
>copy c:\backup\user.dbf c:\oradata\user.dbf (alter tablespace offline)
>recover datafile 'c:\oradata\user.dbf' or
>recover tablespace user_data;
>alter database datafile 'c:\oradata\user.dbf' online or
>alter tablespace user_data online;
--method 3(opened database,initially closed not system or rollback datafile)
>startup mount
>alter database datafile 'c:\oradata\user.dbf' offline;
>alter database open
>copy c:\backup\user.dbf d:\oradata\user.dbf
>alter database rename file 'c:\oradata\user.dbf' to 'd:\oradata\user.dbf'
>recover datafile 'e:\oradata\user.dbf' or recover tablespace user_data;
>alter tablespace user_data online;
--method 4(loss of data file with no backup and have all archive log)
>alter tablespace user_data offline immediate;
>alter database create datafile 'd:\oradata\user.dbf' as 'c:\oradata\user.dbf''
>recover tablespace user_data;
>alter tablespace user_data online
5.perform an open database backup
> alter tablespace user_data begin backup;
> copy files /backup/
> alter database datafile '/c:/../data.dbf' end backup;
> alter system switch logfile;
6.backup a control file
> alter database backup controlfile to 'control1.bkp';
> alter database backup controlfile to trace;
7.recovery (noarchivelog mode)
> shutdown abort
> cp files
> startup
8.recovery of file in backup mode
>alter database datafile 2 end backup;
9.clearing redo log file
>alter database clear unarchived logfile group 1;
>alter database clear unarchived logfile group 1 unrecoverable datafile;
10.redo log recovery
>alter database add logfile group 3 'c:\oradata\redo03.log' size 1000k;
>alter database drop logfile group 1;
>alter database open;
or >cp c:\oradata\redo02.log' c:\oradata\redo01.log
>alter database clear logfile 'c:\oradata\log01.log';
ORACLE dblink 的建立- -
1.在tnsnames.ora增加对备份数据库的指向,取名***(增加完毕后,用sqlplus进行验证)tnsping ***
2.登录本地数据库
3.CREATE DATABASE LINK *** CONNECT TO “目标用户名” IDENTIFIED BY “目标用户密码” USING '标识串';
Create database link chsflora113 connect to flora indentified by kibflora2006 using ‘chsflora’
连接数据库chsflora,并创建连接名为chsflora113的dblink。