rman的連接
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)