日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

使用rman本机复制新数据库

發布時間:2024/1/17 数据库 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用rman本机复制新数据库 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

使用rman復制數據庫


原數據庫sid orcl ?復制新的數據庫sid為 nylg


1.創建復制備份數據庫的參數文件

在原數據庫創建pfile

create pfile from spfile;

然后復制pfile參數文件

[oracle@Nagiostest dbs]$ pwd

/u01/app/oracle/product/11.2/dbs

[oracle@Nagiostest dbs]$ cp initorcl.ora initnylg.ora?

修改orcl數據庫名改為nylg

vi initnylg.ora 修改如下:

:%s/orcl/nylg/g


在這里注意,修改參數文件后,在最后行添加兩行轉換參數,指定新數據文件存放路徑

db_file_name_convert = ('/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/nylg')

log_file_name_convert = ('/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/nylg')




2.創建相對應的目錄,啟動復制數據庫的輔助實例

mkdir -p $ORACLE_BASE/admin/nylg/{a,b,c,u}dump

mkdir -p /u01/app/oracle/oradata/nylg

orapwd file=$ORACLE_HOME/dbs/orapwnylg password=yuanlei force=y

[oracle@Nagiostest ~]$ export ORACLE_SID=nylg


使用pfile啟動輔助實例到nomount

startup nomount pfile=?/dbs/initnylg.ora ??


如下:

[oracle@Nagiostest ~]$ export ORACLE_SID=nylg

[oracle@Nagiostest ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 13 10:27:25 2014

Copyright (c) 1982, 2009, Oracle. ?All rights reserved.

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup nomount pfile=?/dbs/initnylg.ora

ORACLE instance started.


Total System Global Area ?413372416 bytes

Fixed Size ? ?2213896 bytes

Variable Size ?314574840 bytes

Database Buffers ? 92274688 bytes

Redo Buffers ? ?4308992 bytes





3.在新的會話中(ORACLE_SID=orcl)對原數據庫做rman全備

export ORACLE_SID=orcl

rman target /


run {

sql 'alter system archive log current';

backup database format='/u01/rmanbak/%d_%s.dbf'

plus archivelog format='/u01/rmanbak/%d_%s.arc';

sql 'alter system archive log current';

}




4.配置復制庫監聽(就是本機的監聽文件),服務名采用靜態注冊,啟動監聽,這步很重要

不要有錯誤


[oracle@Nagiostest admin]$ vim listener.ora?

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2/network/admin/listener.ora

# Generated by Oracle configuration tools.


SID_LIST_LISTENER =

? (SID_LIST =

? ? (SID_DESC =

? ? ? (SID_NAME = PLSExtProc)

? ? ? (ORACLE_HOME = /u01/app/oracle/product/11.2)

? ? ? (PROGRAM = extproc)

? ? )

? ? (SID_DESC =

? ? ? (SID_NAME = nylg)

? ? ? (ORACLE_HOME = /u01/app/oracle/product/11.2)

? ? ? (GLOBAL_DBNAME = NYLG)

? ? )

? )



ADR_BASE_LISTENER = /u01/app/oracle


[oracle@Nagiostest admin]$ vim tnsnames.ora?

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.


NYLG =

? (DESCRIPTION =

? ? (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.210)(PORT = 1521))

? ? (CONNECT_DATA =

? ? ? (SERVER = DEDICATED)

? ? ? (SERVICE_NAME = nylg)

? ? )

? )




lsnrctl start


5.用rman連接到主庫實例和輔助實例,運行復制命令


[oracle@Nagiostest dbs]$ rman target /


Recovery Manager: Release 11.2.0.1.0 - Production on Wed Aug 13 11:01:56 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates. ?All rights reserved.


connected to target database: ORCL (DBID=1382226447)


RMAN> connect auxiliary sys/yuanlei@nylg


connected to auxiliary database: NYLG (not mounted)


這里如果遇到

RMAN-04006: error from auxiliary database: ORA-01031: insufficient privileges

請檢查你的監聽配置和口令文件是否正確,一般就這兩個原因(我做的時候是把監聽sid大寫小弄錯)


然后繼續


RMAN> duplicate target database to nylg;


其它配置沒問題話的,這里等一會就完成了


Starting Duplicate Db at 2014/08/13 11:02:38

using target database control file instead of recovery catalog

.

.

.復制過程

.

.

contents of Memory Script:

{

? ?Alter clone database open resetlogs;

}

executing Memory Script

database opened

Finished Duplicate Db at 2014/08/13 11:07:26



此時新的數據庫已經處于open狀態了!





[oracle@Nagiostest ~]$ echo $ORACLE_SID

nylg

[oracle@Nagiostest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 13 11:08:49 2014

Copyright (c) 1982, 2009, Oracle. ?All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select status from v$instance;


STATUS

------------

OPEN




OK!


轉載于:https://blog.51cto.com/paopao5541/1539308

總結

以上是生活随笔為你收集整理的使用rman本机复制新数据库的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。