Decode360's Blog

业精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

  BlogJava :: 首页 :: 新随笔 :: 联系 ::  :: 管理 ::
  302 随笔 :: 26 文章 :: 82 评论 :: 0 Trackbacks
RMAN的登录
 
 
 
1、使用RMAN时,需要将数据库设置为归档模式
 
SQL> conn sys/sys as sysdba

Connected.

SQL> show user

USER is "SYS"

SQL> archive log list

Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            D:\oracle\oradata\dodo\archive
Oldest online log sequence     26
Next log sequence to archive   28
Current log sequence           28
 
开启归档:
a. shutdown immediate
b. startup mount
c. alter database archivelog
d. alter database opne
禁止归档:
a.
shutdown immediate
b. startup mount
c. alter database noarchivelog
d. alter database open
 
 
2、创建备份用户和表空间:
 
SQL> create tablespace recovery_tbs datafile 'D:\oracle\oradata\dodo\recovery_tbs.ora' size 15M autoextend on next 10M;
 
Tablespace created
 
SQL> create user rman identified by rman default tablespace recovery_tbs;
 
User created
 
SQL> grant connect,resource,recovery_catalog_owner to rman;
 
Grant succeeded
 
SQL> alter user rman quota unlimited on recovery_tbs;
 
User altered
 
 
 
3、登录rman:
 
①登录rman后使用connect target命令登录:
 
C:\Documents and Settings\wangxiaoqi>set oracle_sid=dodo
 
C:\Documents and Settings\wangxiaoqi>rman
 
Recovery Manager: Release 9.2.0.1.0 - Production
 
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
 
RMAN> connect target /
 
connected to target database: DODO (DBID=472976704)
 
②直接用rman命令登录:
 
C:\Documents and Settings\wangxiaoqi>rman target /
 
Recovery Manager: Release 9.2.0.1.0 - Production
 
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
 
connected to target database: DODO (DBID=472976704)
 
RMAN>
 
③链接远程数据库:
 
C:\Documents and Settings\wangxiaoqi>rman target sys/sys as sysdba @dodo2
 
Recovery Manager: Release 9.2.0.1.0 - Production
 
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
 
connected to target database: DODO2 (DBID=472976705)
 
RMAN>
 
 
 
4、创建恢复目录:
 
C:\Documents and Settings\wangxiaoqi>rman
 
Recovery Manager: Release 9.2.0.1.0 - Production
 
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
 
RMAN> connect catalog rman/rman
 
connected to recovery catalog database
recovery catalog is not installed
 
RMAN> create catalog;
 
recovery catalog created
 
若想把恢复目录创建到其他表空间,则使用:
RMAN> create catalog tablespace XXX;
删除恢复目录:
RMAN> drop catalog;
 
 
5、连接恢复目录:
 
在登录RMAN后连接:
RMAN> connect catalog rman/rman
 
connected to recovery catalog database
 
也可以直接登录时就连接:
C:\Documents and Settings\wangxiaoqi>rman target / catalog rman/rman
 
Recovery Manager: Release 9.2.0.1.0 - Production
 
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
 
connected to target database: DODO (DBID=472976704)
connected to recovery catalog database
 
RMAN>
 
不连接catalog:
C:\Documents and Settings\wangxiaoqi>rman target / nocatalog
 
Recovery Manager: Release 9.2.0.1.0 - Production
 
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
 
connected to target database: DODO (DBID=472976704)
using target database controlfile instead of recovery catalog
 
 
6、注册数据库:
 
在RMAN中有恢复目录的情况下,连接目标数据后还需要注册数据库
即将目标数据库中的控制文件转到恢复目录中
同一个恢复目录中只能注册一个目标数据库。
 
RMAN> register database;
 
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
 
 
7、使用log方式登录:
 
首先创建一个用于记录log信息的文件
然后在登录时使用:
 
C:\Documents and Settings\wangxiaoqi>rman target / log D:\oracle\oradata\dodo\logs\rman_log.txt
RMAN>
 
当使用了log时,所有的信息将不在屏幕上打印,而直接存入log文件中
所以一般操作还是不要使用log,当执行一个很长的批处理时,可能需要在log文件中记录下操作信息
 
 
 
 
 




-The End-

posted on 2008-09-11 22:29 decode360-3 阅读(696) 评论(1)  编辑  收藏 所属分类: Oracle

评论

# re: RMAN学习笔记(一) 2014-10-09 16:25 少林功夫好
有个小错误。归档模式步骤中的open写错成opne了。  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: