RMAN 异机迁移

Jun 07, 2016 pm 05:20 PM
oracle 데이터 베이스

目标库准备实例名准备:此实例名为原库的实例名。 不要随意设, 因控制文件里是有记录DB_NAME的, 如果你随便设置实例名,是没办

1. 环境说明:
原机:192.168.102.156     Oracle 10.2.0.1
目标:192.168.102.157     ORACLE 10.2.0.1
2.对数据库做创建一张表。
SQL> create table rmantest(id number(9));
Table created.
SQL> insert into rmantest(id) values(88);
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
3. 目标库准备实例名准备:此实例名为原库的实例名。 不要随意设, 因控制文件里是有记录DB_NAME的, 如果你随便设置实例名,是没办法完成迁移的。
[oracle@GOLDENGATE2 ~]$ export ORACLE_SID=gg1
[oracle@GOLDENGATE2 ~]$ echo $ORACLE_SID
gg1
4. 目标库准备参数文件。
(1) 在原库创建一个PFILE文件。
SQL> create pfile='/home/oracle/initgg1.ora' from spfile;
File created.
(2) 奖参数文件移至目标库。
[oracle@GOLDENGATE1 ~]$ scp initgg1.oraoracle@192.168.102.157:/home/oracle
oracle@192.168.102.157'spassword:
initgg1.ora                                                                                                100% 1051     1.0KB/s   00:00
5. 在目标库创建参数文件中所需要的目录。
[oracle@GOLDENGATE2 ~]$ mkdir -p admin/gg1/adump
[oracle@GOLDENGATE2 ~]$ mkdir -p admin/gg1/bdump
[oracle@GOLDENGATE2 ~]$ mkdir -p admin/gg1/cdump
[oracle@GOLDENGATE2 ~]$ mkdir -p admin/gg1/dpdump
[oracle@GOLDENGATE2 ~]$ mkdir -p admin/gg1/udump
[oracle@GOLDENGATE2 ~]$ mkdir flash_recovery_area
[oracle@GOLDENGATE2 ~]$ mkdir -p oradata/gg1
[oracle@GOLDENGATE2 ~]$ mkdir archivelog
6. 在目标库创建SPFILE文件,并将数据库启动到NOMOUNT状态。
[oracle@GOLDENGATE2 ~]$ export ORACLE_SID=gg1
[oracle@GOLDENGATE2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 21 01:21:51 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile='/home/oracle/initgg1.ora';
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1218292 bytes
Variable Size              83888396 bytes
Database Buffers           75497472 bytes
Redo Buffers                7168000 bytes
 
7. 对原数据库进行热备份。 必备条件: 数据库属归档模式。
[oracle@GOLDENGATE1 ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 21 01:21:49 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: GG1 (DBID=1620494887)
RMAN>  run{
allocate channel a1 type disk;
allocate channel a2 type disk;
backup format='/home/oracle/rman/full_%d_%T_%s'  database;
backup format='/home/oracle/rman/arch_%d_%T_%s' archivelog all;
backup format='/home/oracle/rman/ctl_%U' current controlfile;
release channel a2;
 release channel a1;
}2> 3> 4> 5> 6> 7> 8> 9>
released channel: ORA_DISK_1
allocated channel: a1
channel a1: sid=158 devtype=DISK
allocated channel: a2
channel a2: sid=141 devtype=DISK
Starting backup at 21-SEP-12
channel a1: starting full datafile backupset
channel a1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/oracle/oradata/gg1/system01.dbf
input datafile fno=00005 name=/home/oracle/oradata/gg1/example01.dbf
input datafile fno=00003 name=/home/oracle/oradata/gg1/sysaux01.dbf
channel a1: starting piece 1 at 21-SEP-12
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
input datafile fno=00006 name=/home/oracle/oradata/gg1/gg01.dbf
input datafile fno=00002 name=/home/oracle/oradata/gg1/undotbs01.dbf
input datafile fno=00004 name=/home/oracle/oradata/gg1/users01.dbf
channel a2: starting piece 1 at 21-SEP-12
channel a2: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/full_GG1_20120921_10 tag=TAG20120921T013222 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:25
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
including current control file in backupset
channel a2: starting piece 1 at 21-SEP-12
channel a2: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/full_GG1_20120921_11 tag=TAG20120921T013222 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:03
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
including current SPFILE in backupset
channel a2: starting piece 1 at 21-SEP-12
channel a2: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/full_GG1_20120921_12 tag=TAG20120921T013222 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:02
channel a1: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/full_GG1_20120921_9 tag=TAG20120921T013222 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:48
Finished backup at 21-SEP-12
Starting backup at 21-SEP-12
current log archived
channel a1: starting archive log backupset
channel a1: specifying archive log(s) in backup set
input archive log thread=1 sequence=4 recid=1 stamp=794527523
channel a1: starting piece 1 at 21-SEP-12
channel a2: starting archive log backupset
channel a2: specifying archive log(s) in backup set
input archive log thread=1 sequence=5 recid=2 stamp=794538401
input archive log thread=1 sequence=6 recid=3 stamp=794539337
input archive log thread=1 sequence=7 recid=4 stamp=794539385
channel a2: starting piece 1 at 21-SEP-12
channel a2: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/arch_GG1_20120921_13 tag=TAG20120921T013312 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:02
channel a1: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/arch_GG1_20120921_14 tag=TAG20120921T013312 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:03
channel a2: starting archive log backupset
channel a2: specifying archive log(s) in backup set
input archive log thread=1 sequence=8 recid=5 stamp=794539992
channel a2: starting piece 1 at 21-SEP-12
channel a2: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/arch_GG1_20120921_15 tag=TAG20120921T013312 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:02
Finished backup at 21-SEP-12
Starting backup at 21-SEP-12
channel a1: starting full datafile backupset
channel a1: specifying datafile(s) in backupset
including current control file in backupset
channel a1: starting piece 1 at 21-SEP-12
channel a1: finished piece 1 at 21-SEP-12
piece handle=/home/oracle/rman/ctl_0gnlndut_1_1 tag=TAG20120921T013317 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:02
Finished backup at 21-SEP-12
released channel: a2
released channel: a1
8. 将备份移至目标机。
[oracle@GOLDENGATE1 ~]$ cd rman/
[oracle@GOLDENGATE1 rman]$ ls
arch_GG1_20120921_13  arch_GG1_20120921_15  full_GG1_20120921_10  full_GG1_20120921_12
arch_GG1_20120921_14  ctl_0gnlndut_1_1      full_GG1_20120921_11  full_GG1_20120921_9
[oracle@GOLDENGATE1 rman]$ scp *oracle@192.168.102.157:/home/oracle/rman
oracle@192.168.102.157'spassword:
arch_GG1_20120921_13                                                                                       100%   13MB  12.8MB/s   00:01  
arch_GG1_20120921_14                                                                                       100%   25MB  12.5MB/s   00:02  
arch_GG1_20120921_15                                                                                       100%  281KB 281.0KB/s   00:00  
ctl_0gnlndut_1_1                                                                                           100% 6944KB   6.8MB/s   00:00  
full_GG1_20120921_10                                                                                       100%   33MB   8.2MB/s   00:04  
full_GG1_20120921_11                                                                                       100% 6944KB   6.8MB/s   00:00  
full_GG1_20120921_12                                                                                       100%   96KB  96.0KB/s   00:01  
full_GG1_20120921_9                                                                                        100%  561MB  11.9MB/s   00:47  
9. 在目标机上恢复控制文件。
[oracle@GOLDENGATE2 rman]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 21 01:36:10 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: gg1 (not mounted)
RMAN> restore controlfile from '/home/oracle/rman/ctl_0gnlndut_1_1';
Starting restore at 21-SEP-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/home/oracle/oradata/gg1/control01.ctl
output filename=/home/oracle/oradata/gg1/control02.ctl
output filename=/home/oracle/oradata/gg1/control03.ctl
Finished restore at 21-SEP-12
10. 启动数据库到MOUNT状态。
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
11.恢复数据库。
RMAN> restore database;
Starting restore at 21-SEP-12
Starting implicit crosscheck backup at 21-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 21-SEP-12
Starting implicit crosscheck copy at 21-SEP-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 21-SEP-12
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /home/oracle/oradata/gg1/undotbs01.dbf
restoring datafile 00004 to /home/oracle/oradata/gg1/users01.dbf
restoring datafile 00006 to /home/oracle/oradata/gg1/gg01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/rman/full_GG1_20120921_10
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/rman/full_GG1_20120921_10 tag=TAG20120921T013222
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/oradata/gg1/system01.dbf
restoring datafile 00003 to /home/oracle/oradata/gg1/sysaux01.dbf
restoring datafile 00005 to /home/oracle/oradata/gg1/example01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/rman/full_GG1_20120921_9
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/rman/full_GG1_20120921_9 tag=TAG20120921T013222
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 21-SEP-12
RMAN> recover database;
Starting recover at 21-SEP-12
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=8
channel ORA_DISK_1: reading from backup piece /home/oracle/rman/arch_GG1_20120921_15
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/rman/arch_GG1_20120921_15 tag=TAG20120921T013312
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/home/oracle/archivelog/1_8_794474474.dbf thread=1 sequence=8
unable to find archive log
archive log thread=1 sequence=9
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/21/2012 01:38:18
RMAN-06054: media recovery requesting unknown log: thread 1 seq 9 lowscn 529513
查看原库日志:
[oracle@GOLDENGATE1 archivelog]$ ls
1_4_794474474.dbf  1_5_794474474.dbf  1_6_794474474.dbf  1_7_794474474.dbf  1_8_794474474.dbf
[oracle@GOLDENGATE1 archivelog]$
干, 这里就没有那日志。
因为原库并未生成SEQ为9的日志,这里根本就没有9的备份。
用SQLPLUS连进行执行恢复。
SQL> recover database using backup controlfile;
ORA-00279: change 529513 generated at 09/21/2012 01:33:11 needed for thread 1
ORA-00289: suggestion : /home/oracle/archivelog/1_9_794474474.dbf
ORA-00280: change 529513 for thread 1 is in sequence #9
 
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
12。 打开数据库。
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/home/oracle/oradata/gg1/system01.dbf'
因为控制文件和数据文件不一致。
解决办法:
修改参数文件:增加 _allow_resetlogs_corruption='TURE'
关闭数据库,重建SPFILE文件,,并启动到NOMOUNT状态。
打开数据库:
SQL> alter database open resetlogs;
Database altered.
13。 检查
REDO日志和临时表空间文件会在打开数据库时根据控制文件中的记录去创建。
查看原库所建的表:
SQL> select * from rmantest;
        ID
----------
        88
迁移完成。

linux

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Oracle 데이터베이스 로그는 얼마나 오래 보관됩니까? Oracle 데이터베이스 로그는 얼마나 오래 보관됩니까? May 10, 2024 am 03:27 AM

Oracle 데이터베이스 로그의 보존 기간은 다음을 포함한 로그 유형 및 구성에 따라 다릅니다. 재실행 로그: "LOG_ARCHIVE_DEST" 매개변수로 구성된 최대 크기에 의해 결정됩니다. 보관된 리두 로그: "DB_RECOVERY_FILE_DEST_SIZE" 매개변수로 구성된 최대 크기에 따라 결정됩니다. 온라인 리두 로그: 보관되지 않고 데이터베이스를 다시 시작하면 손실되며 보존 기간은 인스턴스 실행 시간과 일치합니다. 감사 로그: "AUDIT_TRAIL" 매개변수로 구성되며 기본적으로 30일 동안 보관됩니다.

Oracle 데이터베이스 서버 하드웨어 구성 요구 사항 Oracle 데이터베이스 서버 하드웨어 구성 요구 사항 May 10, 2024 am 04:00 AM

Oracle 데이터베이스 서버 하드웨어 구성 요구 사항: 프로세서: 기본 주파수가 2.5GHz 이상인 멀티 코어, 대규모 데이터베이스의 경우 32개 이상의 코어가 권장됩니다. 메모리: 소규모 데이터베이스의 경우 최소 8GB, 중간 크기의 경우 16~64GB, 대규모 데이터베이스 또는 과도한 작업 부하의 경우 최대 512GB 이상. 스토리지: SSD 또는 NVMe 디스크, 중복성 및 성능을 위한 RAID 어레이. 네트워크: 고속 네트워크(10GbE 이상), 전용 네트워크 카드, 지연 시간이 짧은 네트워크. 기타: 안정적인 전원 공급 장치, 이중 구성 요소, 호환 가능한 운영 체제 및 소프트웨어, 열 방출 및 냉각 시스템.

오라클에는 얼마나 많은 메모리가 필요합니까? 오라클에는 얼마나 많은 메모리가 필요합니까? May 10, 2024 am 04:12 AM

Oracle에 필요한 메모리 양은 데이터베이스 크기, 활동 수준 및 필요한 성능 수준(데이터 버퍼 저장, 인덱스 버퍼, SQL 문 실행 및 데이터 사전 캐시 관리에 필요)에 따라 다릅니다. 정확한 양은 데이터베이스 크기, 활동 수준 및 필요한 성능 수준에 따라 달라집니다. 모범 사례에는 적절한 SGA 크기 설정, SGA 구성 요소 크기 조정, AMM 사용 및 메모리 사용량 모니터링이 포함됩니다.

Oracle 예약 작업은 하루에 한 번 생성 단계를 실행합니다. Oracle 예약 작업은 하루에 한 번 생성 단계를 실행합니다. May 10, 2024 am 03:03 AM

Oracle에서 하루에 한 번 실행되는 예약된 작업을 생성하려면 다음 세 단계를 수행해야 합니다. 작업을 생성합니다. 작업에 하위 작업을 추가하고 해당 일정 표현식을 "INTERVAL 1 DAY"로 설정합니다. 작업을 활성화합니다.

Oracle 데이터베이스를 사용하는 데 필요한 메모리 양 Oracle 데이터베이스를 사용하는 데 필요한 메모리 양 May 10, 2024 am 03:42 AM

Oracle 데이터베이스에 필요한 메모리 양은 데이터베이스 크기, 작업 부하 유형 및 동시 사용자 수에 따라 다릅니다. 일반 권장 사항: 소형 데이터베이스: 16~32GB, 중형 데이터베이스: 32~64GB, 대형 데이터베이스: 64GB 이상. 고려해야 할 다른 요소로는 데이터베이스 버전, 메모리 최적화 옵션, 가상화 및 모범 사례(메모리 사용량 모니터링, 할당 조정)가 있습니다.

Oracle 데이터베이스에는 얼마나 많은 메모리가 필요합니까? Oracle 데이터베이스에는 얼마나 많은 메모리가 필요합니까? May 10, 2024 am 02:09 AM

Oracle 데이터베이스 메모리 요구 사항은 데이터베이스 크기, 활성 사용자 수, 동시 쿼리, 활성화된 기능 및 시스템 하드웨어 구성 등의 요소에 따라 달라집니다. 메모리 요구 사항을 결정하는 단계에는 데이터베이스 크기 결정, 활성 사용자 수 추정, 동시 쿼리 이해, 활성화된 기능 고려 및 시스템 하드웨어 구성 검사가 포함됩니다.

오라클에서 듣기 프로그램을 시작하는 방법 오라클에서 듣기 프로그램을 시작하는 방법 May 10, 2024 am 03:12 AM

Oracle 수신기는 클라이언트 연결 요청을 관리하는 데 사용됩니다. 시작 단계에는 다음이 포함됩니다. Oracle 인스턴스에 로그인합니다. 리스너 구성을 찾으십시오. lsnrctl start 명령을 사용하여 리스너를 시작하십시오. lsnrctl status 명령을 사용하여 시작을 확인합니다.

PHP에서 MySQLi를 사용하여 데이터베이스 연결을 설정하는 방법에 대한 자세한 튜토리얼 PHP에서 MySQLi를 사용하여 데이터베이스 연결을 설정하는 방법에 대한 자세한 튜토리얼 Jun 04, 2024 pm 01:42 PM

MySQLi를 사용하여 PHP에서 데이터베이스 연결을 설정하는 방법: MySQLi 확장 포함(require_once) 연결 함수 생성(functionconnect_to_db) 연결 함수 호출($conn=connect_to_db()) 쿼리 실행($result=$conn->query()) 닫기 연결( $conn->close())

See all articles