1 本地连接
[oracle@pc6 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Mar 24 21:23:15 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: HYYK (DBID=2117284640)
2.远处连接
首先在远程创建tnsnames
[oracle@ogg-80 admin]$ vim tnsnames.ora
HYYK =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.51)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hyyk)
)
)
其次在远程链接
[oracle@ogg-80 ~]$ rman target sys/oracle@hyyk
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Mar 24 21:38:51 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
PL/SQL package SYS.DBMS_BACKUP_RESTORE version 11.02.00.01 in TARGET database is not current
PL/SQL package SYS.DBMS_RCVMAN version 11.02.00.01 in TARGET database is not current
connected to target database: HYYK (DBID=2117284640)
这里说明一下rman和数据库的权限RMAN 需要访问目标数据库上sys用户存在的各种数据包,还需要具有启动和关闭目标数据库的权限。因此RMAN 通常以sysdba 用户身份连接到目标数据库。 如果以不具有sysdba 权限的用户连接到目标数据库,RMAN 会报ORA-01031: insufficient privileges 错误。
做以下实验
创建一个用户
SYS@hyyk> create user rman identified by rman;
授予权限
SYS@hyyk> grant connect,resource to rman;
测试连接
[oracle@pc6 ~]$ rman target rman/rman
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Mar 24 21:43:04 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: HYYK (DBID=2117284640)
如果在远程用rman用户连接
[oracle@ogg-80 ~]$ rman target rman/rman@hyyk
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Mar 24 21:45:03 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01031: insufficient privileges
这里在本机授予rman用户sysdba权限
SYS@hyyk> grant sysdba to rman;
Grant succeeded.
在次从远程连连接,显示连接成功
[oracle@ogg-80 ~]$ rman target rman/rman@hyyk
Recovery Manager: Release 11.2.0.4.0 - Production on Sat Mar 24 21:59:32 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
PL/SQL package SYS.DBMS_BACKUP_RESTORE version 11.02.00.01 in TARGET database is not current
PL/SQL package SYS.DBMS_RCVMAN version 11.02.00.01 in TARGET database is not current
connected to target database: HYYK (DBID=2117284640)
本文题目:rman的连接
浏览路径:
http://cdxtjz.cn/article/ggciec.html