ORACLE RMAN操作手册
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ORACLE RMAN操作手册
RMAN可以用来备份和还原数据库文件、归档日志和控制文件。它也可以用来执行完全或不完全的数据库恢复。
注意:RMAN不能用于备份初始化参数文件和口令文件。
RMAN启动数据库上的Oracle服务器进程来进行备份或还原。备份、还原、恢复是由这些进程驱动的。
RMAN可以由OEM的Backup Manager GUI来控制
DB1 (target db)
IP:10.204.200.101
SID: test
DB2 (catalog db)
IP:10.204.200.102
SID:orcl
一打开数据库归档
查看
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle10/app/oracle/product/10.2.0/dbs/arch
Oldest online log sequence 1
Current log sequence 2
设置
alter system set log_archive_dest_1="LOCATION=/oradata/archive MANDATORY REOPEN" scope=spfile;
启动到mount
SQL> startup mount;
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oradata/archive
Oldest online log sequence 1
Current log sequence 2
打开归档:
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oradata/archive
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL> alter database open;
二FLASH BACK DB1
配置FLASH BACK
1.设置参数
alter system set db_recovery_file_dest='/oradata/flash' scope=spfile;
alter system set db_recovery_file_dest_size=2g scope=spfile;
2.启动到mount
startup mount;
3.检查Flashback 功能,缺省时功能是关闭的。
select name, current_scn, flashback_on from v$database;
4.启动FLASHBACK
SQL> alter database flashback on;
SQL> select name, current_scn, flashback_on from v$database;
NAME CURRENT_SCN FLASHBACK_ON
--------- ----------- ------------------
DBA 0 YES
5.查询当前的scn
SQL> SELECT CURRENT_SCN FROM V$DATABASE;
查询当前的时间
SQL> select to_char(sysdate,'yy-mm-dd hh24:mi:ss') time from dual;
SQL> select table_name from dba_tables where owner='HR';
TABLE_NAME
------------------------------
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
SKIP_TEST
COUNTRIES
8 rows selected.
SQL> select * from hr.jobs;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 20000 40000
AD_VP Administration Vice President 15000 30000
AD_ASST Administration Assistant 3000 6000
FI_MGR Finance Manager 8200 16000
FI_ACCOUNT Accountant 4200 9000
AC_MGR Accounting Manager 8200 16000 AC_ACCOUNT Public Accountant 4200 9000
SA_MAN Sales Manager 10000 20000 SA_REP Sales Representative 6000 12000
PU_MAN Purchasing Manager 8000 15000 PU_CLERK Purchasing Clerk 2500 5500
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------