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

歡迎訪問 生活随笔!

生活随笔

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

数据库

数据库不完全恢复 以及恢复到测试环境:

發布時間:2023/12/19 数据库 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数据库不完全恢复 以及恢复到测试环境: 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?sample 1:?

1.清空歸檔日志

RMAN> crosscheck archivelog all;

RMAN> delete achivelog all;

?

2.清空數據文件。

select name from v$datafile;

rm v$datafile

?

3.恢復數據

??##check file date:??

##把db數據恢復到:2017-02-05 00:00:00


?ls -lt /ngenprdblog/
?ls -lt /ngprdb/data
?
?##change data file location to '/ngprdb/data'
?rman nocatalog target /
?catalog start with '/ngprdb/data';
?switch database to copy;

?

(解釋如下)
現在換個角度來考慮,這些控制文件記錄的都是不存在的文件,只是數據庫認為是這些文件,而我的ASM上才是真實的數據文件,那么,
我可以把ASM上的文件都認為是數據文件的copy備份,完全可以使用RMAN的catalog start with手工將這些copy“備份”加進來,數據庫會認為這些文件就只是數據文件的copy備份,然后直接switch database to copy就可以成功切換。)


?### change logfile location to '/ngprdb/data'
?select 'alter database rename file '||''''||member||''''||' to '||chr(39)||replace(member,'/ngenprdb/','/ngprdb/')||''';'? ?
from v$logfile;



?###recover database method 1
recover database;
sql 'alter database open';
?
?##recover database method 2
run{
set until time "to_date('2017-02-05 00:00:00','YYYY-MM-DD? HH24:MI:SS')";
restore database;
recover database;
sql 'alter database open resetlogs';
}


sampe 2 .restore prod db to uat db


initedruat.ora

change db_name
#db_name = edruat
db_name = edrprod

dbngt6[/home/oracle][edruat] >sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue May 9 17:06:05 2017

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 5678927872 bytes
Fixed Size 2215680 bytes
Variable Size 1006633216 bytes
Database Buffers 4664066048 bytes
Redo Buffers 6012928 bytes
Database mounted.
SQL> alter database backup controlfile to trace;

Database altered.

SQL> select * from v$diag_info;


initedruat.ora
change db_name
db_name = edruat
#db_name = edrprod


sed -n "1,2p"
sed -n "70,210p" /edruatdb/diag/rdbms/edrprod/edruat/trace/edruat_ora_8217.trc > /tmp/contrl.sql
set ic
%s/prod/uat/g
%s/PROD/UAT/g


###
ORA-01503: CREATE CONTROLFILE failed
ORA-01161: database name EDRPROD in file header does not match given name of
EDRUAT
ORA-01110: data file 1: '/edruatdb/data/system_f01.dbf'
#####

vi /tmp/contrl.sql
chang "resue" to "SET" and "NORESETLOGS" to "RESETLOGS"

CREATE CONTROLFILE SET DATABASE "DEV" RESETLOGS ARCHIVELOG

?

######
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-00200: control file could not be created
ORA-00202: control file: '/edruatdb/data/cntl01.ctl'
ORA-27038: created file already exists
Additional information: 1
######

mv /edruatdb/data/cntl01.ctl /edruatdb/data/cntl01.ctl.bak
mv /edruatdb/data/cntl02.ctl /edruatdb/data/cntl02.ctl.bak

?

SQL> @/tmp/contrl.sql
ORACLE instance started.

Total System Global Area 5678927872 bytes
Fixed Size 2215680 bytes
Variable Size 1006633216 bytes
Database Buffers 4664066048 bytes
Redo Buffers 6012928 bytes

Control file created.

?

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 9742867340450 generated at 05/08/2017 14:00:07 needed for
thread 1
ORA-00289: suggestion : /edruatdblog/edrprod_863435250_1_37704.arc
ORA-00280: change 9742867340450 for thread 1 is in sequence #37704


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00279: change 9742867342449 generated at 05/08/2017 14:43:31 needed for
thread 1
ORA-00289: suggestion : /edruatdblog/edrprod_863435250_1_37705.arc
ORA-00280: change 9742867342449 for thread 1 is in sequence #37705
ORA-00278: log file '/edruatdblog/edrprod_863435250_1_37704.arc' no longer
needed for this recovery

?

SQL> alter database open resetlogs;

Database altered.

cd /edruatdb/change/env

SQL> @chg_env_edruat.sql

?

?

rm /edruatdb/data/temp_f*

alter tablespace TEMP add tempfile '/edruatdb/data/temp_f01.dbf' size 4000m autoextend on;
alter tablespace TEMP add tempfile '/edruatdb/data/temp_f02.dbf' size 4000m autoextend on;
alter tablespace TEMP add tempfile '/edruatdb/data/temp_f03.dbf' size 4000m autoextend on;

alter database default temporary tablespace temp;

?

?

Solution


How to restore a complete database from an RMAN backup


This note assumes an RMAN catalog is not available. The use of a catalog is optional in this scenario as the backup information is available in the controlfile.

Prior to restoring a database you must ensure you have a valid RMAN backup.

In this example we will assume all files are required to be restored:

* Datafiles
* Controlfiles
* Archivelogs (In order to perform recovery)

Online redo logs and temp files are recreated automatically by RMAN when a resetlogs is issued. Online redo logs and temp files are not backed up by RMAN

Step 1: ?Identify controlfile backup to restore


Note: If? you do not need to restore a controlfile proceed to step 3.


* Locate the RMAN backup you wish to restore.
* These files should be located in the directory where they were backed up to.
* If you have the RMAN backup log available this will also be of assistance.

Within the RMAN backup log you will see the controlfile is backed up last the the piece handle is shown.

....
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2009/01/01 12:00:00
channel ORA_DISK_1: finished piece 1 at 2009/01/01 12:00:02
piece handle=/recovery_area/V11/backupset/2009_05_0 /o1_mf_ncsnf_TAG20090506T11_501tr0h7_.bkp tag=TAG20090506T11 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

If you do not have an RMAN backup log simply locate the last file RMAN backed up.? This should contain the controlfile backup.

Step 2: ?Restore the controlfile

2a) If you DO NOT have a spfile.

If you do have an spfile or init.ora move to Step 2b

If you do not have a valid spfile or init.ora RMAN has the ability to nomount an instance without the requirement of a spfile. This will allow you to restore your spfile from a valid backup.

% rman target /

RMAN> startup nomount force;

You will see this message:

..
starting Oracle instance without parameter file for retrieval of spfile
..

At this point you can restore the spfile:

RMAN> restore spfile from '/recovery_area/V11/backupset/2009_05_05/o1_mf_ncsnf_TAG20_501tr0h7_.bkp';

RMAN> shutdown immediate;

Once the spfile has been successfully restored proceed to Step 2b.

2b)

SQL>?startup?nomount;

Following?the?successful?nomount?of?the?instance?you?are?ready?to?restore?the
controlfile;

NOTE:?The?controlfile?will?be?restored?to?the?following?location:

SQL>?show?parameter?control_files

NAME?TYPE?VALUE
------------------------------------?-----------?------------------------------
control_files?string?/oradata/V11/control01.ctl

%?rman?target?/

You?will?see?the?message:

connected?to?target?database:?V11?(not?mounted)


RMAN> restore controlfile from '/recovery_area/V11/backupset/2009_05_06/o1_mf_ncsnf_TAG20090506T113947_501tr0h7_.bkp';

Starting restore at 2009/05/11 11:01:26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=151 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oradata/V11/control01.ctl
Finished restore at 2009/05/11 11:01:27

In this example the controlfile has been restored to '/oradata/V11/control01.ctl'

Step 3: ?Restore and recover the database

Your next task is to restore the database and perform recovery. ?Mount the database now that the controlfile has been restored:

RMAN> alter database mount;

Now you have two options for recovery.

1) Full/Complete recovery.
2) Point In Time Recovery (PIT)

In both examples it is assumed that all archivelogs are available to perform the recovery.

?

Full recovery
==========

To Perform a full restore and recovery.

run{
restore database;
recover database;
alter database open resetlogs;
}


If you performed a complete recovery with current controlfile and online redologs in place, you might get below error when opening the database with resetlogs:

ORA-01139: RESET LOGS option only valid after an incomplete database recovery

At this point simply open the database without resetlogs option.

PITR Recovery
===========


Point-In-Time Recovery (PITR) would be used if you have decided to restore a database to a particular point in time. This may be warranted for a hardware fault or if you are aware of a database corruption that occured at a certain date/time.

run{
set until time "to_date('Aug 16 2014 10:30:00','Mon DD YYYY HH24:MI:SS')";
restore database;
recover database;
sql 'alter database open resetlogs';
}



NOTE: The above scripts may be altered to allocate more channels. Good practice would be to review the backup log and use the same number of channels for restore as that used by the backup.?

轉載于:https://www.cnblogs.com/feiyun8616/p/6396735.html

總結

以上是生活随笔為你收集整理的数据库不完全恢复 以及恢复到测试环境:的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 日本特黄色片 | 日本精品视频在线观看 | 日本三不卡 | 美女一二三区 | 艳情五月 | 国产女人在线 | 午夜国产一区二区三区 | 黄色网免费 | 天天想你免费观看完整版高清电影 | 国产无码精品一区二区 | 精品国产一区三区 | 黄久久久| www裸玉足久久久 | 亚州黄色 | 高清乱码免费看污 | 精品人妻一区二区三区久久夜夜嗨 | 黄色污在线观看 | 国产特黄级aaaaa片免 | 久久久国产精品 | 女优在线观看 | 秋霞一级视频 | 四虎影视www在线播放 | 亚洲伦理在线 | 亚洲精品色 | 欧美肥妇bwbwbwbxx | 精品蜜桃一区二区三区 | 三级亚洲 | 日韩视频在线观看 | av手机免费观看 | 久久精品综合视频 | 黄色免费网站在线看 | 国产精品一区二区久久毛片 | 在线免费观看视频黄 | 少妇激情偷人三级 | 午夜成人鲁丝片午夜精品 | 成人午夜视频在线免费观看 | 日韩美女视频在线观看 | 久久精品99久久 | 国产精品久久久久久久一区探花 | 精品免费国产一区二区三区四区 | 无码内射中文字幕岛国片 | 毛片的网址 | 国产精品无码天天爽视频 | 中文字幕精品一区二区三区精品 | 亚洲一区二区三区免费看 | 免费av影片| 亚洲狠狠 | 狼人av在线 | av一级在线观看 | 麻豆国产在线播放 | 亚洲美女福利 | 韩国美女啪啪 | 国产一级一片 | 国内精品卡一卡二卡三 | 正在播放木下凛凛88av | 日本加勒比在线 | 美女扒开尿口让男人捅爽 | wwwxxx国产 | 亚洲一线av | 日韩黄视频 | 超碰97在线资源 | avwww.| 亚洲精品日韩丝袜精品 | 奇米影视亚洲春色 | 国产盗摄一区二区三区在线 | 亚洲日本激情 | 久久久久亚洲av无码专区桃色 | 日韩av不卡在线播放 | 天天综合精品 | 骚视频在线观看 | 国产成人综合久久 | 精品美女www爽爽爽视频 | 五月天综合网 | 欧美国产日韩视频 | 九九99精品 | 精品美女www爽爽爽视频 | 伊人久久99 | 亚洲专区免费 | 欧美国产日本在线 | 国产高潮久久 | 国产又黄又粗 | 久久久永久久久人妻精品麻豆 | 91亚洲精品国偷拍自产在线观看 | 欧美91精品 | 少妇特黄a一区二区三区 | 日本少妇激三级做爰在线 | 久久毛片网站 | 精品一区二区三区在线播放 | 国产成人高清视频 | 日韩欧美一区二区三区四区五区 | 97在线免费公开视频 | 找av导航 | 欧美另类videossexo高潮 | 性做久久久久久 | 男女日批网站 | 国产鲁鲁视频在线观看特色 | 亚洲一区二区在线免费 | 激情综 | 精品欧美一区二区三区 |