成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

異地rman恢復數據庫

Source db端:

繁峙ssl適用于網站、小程序/APP、API接口等需要進行數據傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

ORACLE_SID=ygdg

數據文件位置:/u01/app/oracle/oradata/ygdg

Target db端:

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

ORACLE_SID=ygdg

數據文件位置:/u01/app/oracle/oradata/ygdg

【1.原庫rman備份】

[oracle@oraclelinux rman]$ cat rman_for_dg.sh

export ORACLE_SID=ygdg

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

rman target=/ log='/u01/ygtest/fullbackup.log'<<EOF

crosscheck archivelog all;

run

{

allocate channel t1 type disk;

allocate channel t2 type disk;

allocate channel t3 type disk;

allocate channel t4 type disk;

backup as compressed backupset database format '/u01/ygtest/DB%d%s%p%t.bak' TAG='WHOLE BACKUP' section size 30G

plus archivelog format '/u01/ygtest/ARC%d%s%p%t.bak' TAG='ARC BACKUP' delete input;

backup current controlfile format '/u01/ygtest/CTL%d%s%p%t.bak' TAG='CTL BACKUP';

release channel t1;

release channel t2;

release channel t3;

release channel t4;

}

crosscheck backup;

delete noprompt obsolete recovery window of 3 days;

EOF

【2.原庫查看DBID】

export ORACLE_SID=ygdg

rman target=/

連接上之后就可以看得到DBID,記下來

【3.原庫生成pfile】

create pfile='/u01/pfileygdg.ora' from spfile;

【4.備份文件傳至目標庫】

scp /u01/ygtest/*.bak oracle@10.1.1.11:/u01/ygtest 記得確定目錄權限和所屬者

【5.原庫目標庫結合修改pfile,并將修改后的參數文件傳到目標端】

建議將原庫生成的pfile和目標庫的spfile都下載到本地,根據“參數位置看pfile,其他看spfile”的原則進行修改

【6.目標數據庫創(chuàng)建spfile,并使用spfile啟動數據庫到nomount狀態(tài)】

如果上面參數修改沒問題,正常應該是下面這樣:

SQL> startup pfile='/software/pfileygdg.ora';

SQL> create spfile from pfile='/software/pfileygdg.ora';

SQL> shutdown immediate;

SQL> startup nomount;

但是有些參數沒注意修改,就會出現ORA-,不用擔心,看到什么錯改什么就行,如下:

SQL> startup pfile='/software/pfileygdg.ora';

ORACLE 例程已經啟動。

Total System Global Area 221331456 bytes

Fixed Size 2251856 bytes

Variable Size 163578800 bytes

Database Buffers 50331648 bytes

Redo Buffers 5169152 bytes

ORA-00201: control file version 11.2.0.4.0 incompatible with ORACLE version 11.2.0.0.0

ORA-00202: control file: '/u01/app/oracle/oradata/ygdg/control01.ctl'

分析:查看參數文件中compatible值為11.2.0.0.0,與控制文件中的值沖突;

解決:

SQL> create spfile from pfile='/software/pfileygdg.ora';

文件已創(chuàng)建。

SQL> shutdown immediate;

ORA-01507: ??????

ORACLE 例程已經關閉。

解決:修改spfile文件compatible參數后,使用spfile啟動

SQL> startup nomount;

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initygdg.ora'

解決此問題的方法就是到cd /u01/app/oracle/admin/ygdg/pfile/目錄下,將init.ora.25201817331

復制到dbs目錄下:

cp init.ora.25201817331 /u01/app/oracle/product/11.2.0/db_1/dbs/initygdg.ora

SQL> startup nomount;

ORACLE 例程已經啟動。

Total System Global Area 830930944 bytes

Fixed Size 2257800 bytes

Variable Size 536874104 bytes

Database Buffers 285212672 bytes

Redo Buffers 6586368 bytes

SQL> exit

從 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

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

【7.還原控制文件】

[oracle@localhost database]$ rman target=/

恢復管理器: Release 11.2.0.4.0 - Production on 星期一 3月 5 19:20:26 2018

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

已連接到目標數據庫: YGDG (未裝載)

RMAN> set dbid=2428115541

RMAN> restore controlfile from '/software/ygtest/CTL_YGDG_55_1_969977274.bak';

RMAN> alter database mount;

【8.指定備份文件所在目錄】

RMAN> catalog start with '/software/ygtest';

【9.還原與恢復數據庫】

RMAN> run{

set newname for datafile 1 to "/u01/app/oracle/oradata/ygdg/system01.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/ygdg/sysaux01.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/ygdg/undotbs01.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/ygdg/users01.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/ygdg/test01.dbf";

set newname for tempfile 1 to "/u01/app/oracle/oradata/ygdg/temp01.dbf";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/ygdg/redo01a.log'' to ''/u01/app/oracle/oradata/ygdg/redo01a.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/ygdg/redo02a.log'' to ''/u01/app/oracle/oradata/ygdg/redo02a.log'' ";

}

RMAN> run{

restore database;

SWITCH DATAFILE ALL;

recover database;

} # update control file with new filenames

注:1.原庫執(zhí)行

SQL> select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'

from v$datafile a union all select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";' from v$tempfile a;

'SETNEWNAMEFORDATAFILE'||A.FILE#||'TO"'||A.NAME||'";'


set newname for datafile 1 to "/u01/app/oracle/oradata/ygdg/system01.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/ygdg/sysaux01.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/ygdg/undotbs01.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/ygdg/users01.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/ygdg/test01.dbf";

set newname for tempfile 1 to "/u01/app/oracle/oradata/ygdg/temp01.dbf";

已選擇6行。

SQL>

SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || ''''' to ''''' || a.MEMBER || ''''' ";' FROM v$logfile a;


SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/ygdg/redo01a.log'' to

''/u01/app/oracle/oradata/ygdg/redo01a.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/ygdg/redo02a.log'' to

''/u01/app/oracle/oradata/ygdg/redo02a.log'' ";

2.使用newnam for datafile來實現修改不同的文件路徑

3.switch datafile all用來更新還原回來的controlfile中的數據文件路徑與聯機日志文件路徑,要不然recover時會報錯RMAN-06094

[oracle@localhost database]$ sqlplus / as sysdba

SQL> select status from v$instance;

STATUS


MOUNTED

SQL> alter database open resetlogs;

數據庫已更改。

本文標題:異地rman恢復數據庫
路徑分享:http://jinyejixie.com/article14/jpcoge.html

成都網站建設公司_創(chuàng)新互聯,為您提供營銷型網站建設、建站公司、手機網站建設、網站收錄、ChatGPT、標簽優(yōu)化

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯

手機網站建設
财经| 东乌珠穆沁旗| 民县| 仲巴县| 潮安县| 宝兴县| 忻州市| 九江县| 鄂州市| 吉水县| 南平市| 龙泉市| 蛟河市| 寻乌县| 静安区| 蛟河市| 井研县| 莆田市| 佳木斯市| 顺平县| 芷江| 遂川县| 泸水县| 鄱阳县| 桦南县| 岳池县| 桑日县| 亳州市| 乐平市| 巴青县| 晋州市| 海城市| 宜黄县| 安徽省| 上栗县| 永泰县| 昌邑市| 石狮市| 孝昌县| 保康县| 陈巴尔虎旗|