使用 NFS 的資料遷移實驗過程

紅葉DBA發表於2011-02-27
使用 NFS 的資料遷移

實驗背景:
Server 1:192.168.88.2,NFS伺服器,資料來源
Server 2:192.168.88.3,NFS客戶端,目標主機
Server 1和Server 2都有如下別名:
alias sql='rlwrap sqlplus /nolog'
alias rman='rlwrap rman'
alias dbs='cd $ORACLE_HOME/dbs'
alias rdb='cd $ORACLE_HOME/rdbms/admin'
alias udu='cd $ORACLE_BASE/admin/$ORACLE_SID/udump'
alias bdu='cd $ORACLE_BASE/admin/$ORACLE_SID/bdump'
alias rmalert='rm -f $ORACLE_BASE/admin/$ORACLE_SID/bdump/*;rm -f $ORACLE_BASE/admin/$ORACLE_SID/udump/*'

Server 1:
配置NFS伺服器端引數:
[root@ORA10G ~]# cat /etc/exports
# Below is the NFS settiings
/oracle/flash_recovery_area     192.169.88.3/10(rw,async)
此引數配置完一定要重啟NFS服務,使新的引數生效:
[root@ORA10G ~]# service nfs restart

Server 2:
使用root使用者將Server 1的FRA目錄掛載到Server 2的FRA目錄中(如果沒有此目錄,可以自行建立)
[oracle@ORA10G2 dbs]$ su -
Password:
[root@ORA10G2 ~]# ping 192.168.88.2
PING 192.168.88.2 (192.168.88.2) 56(84) bytes of data.
64 bytes from 192.168.88.2: icmp_seq=0 ttl=64 time=18.0 ms
64 bytes from 192.168.88.2: icmp_seq=1 ttl=64 time=0.177 ms

--- 192.168.88.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.177/9.094/18.011/8.917 ms, pipe 2

[root@ORA10G2 ~]# mount -t nfs 192.168.88.2:/oracle/flash_recovery_area /oracle/flash_recovery_area/
[root@ORA10G2 ~]# ll /oracle/flash_recovery_area/
ls: /oracle/flash_recovery_area/: Permission denied

[root@ORA10G2 dbs]$ mount
/dev/sda2 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda3 on /oracle type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.88.2:/oracle/flash_recovery_area on /oracle/flash_recovery_area type nfs (rw,addr=192.168.88.2)

[root@ORA10G2 ~]# exit
logout

[oracle@ORA10G2 dbs]$ ll /oracle/flash_recovery_area/
total 8
drwxr-x---  4 oracle oinstall 4096 Feb 17 19:54 CATDB
drwxr-x---  6 oracle oinstall 4096 Feb 17 19:20 HONGYE

[oracle@ORA10G2 dbs]$ ll
total 28
-rw-r--r--  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall   946 Feb 18 10:36 inithongye.ora
-rw-r-----  1 oracle oinstall  2469 Feb 11 20:59 init.ora
-rw-r-----  1 oracle oinstall   694 Feb 17 19:34 sqlnet.log
[oracle@ORA10G2 dbs]$ vi inithongye.ora
*.audit_file_dest='/oracle/admin/hongye/adump'
*.background_dump_dest='/oracle/admin/hongye/bdump'
*.compatible='10.2.0.5.0'
*.control_files='/oracle/oradata/hongye/control01.ctl','/oracle/oradata/hongye/control02.ctl','/oracle/oradata/hongye/control03.ctl'
*.core_dump_dest='/oracle/admin/hongye/cdump'
*.db_block_size=8192
*.db_domain='oracle.com'
*.db_file_multiblock_read_count=16
*.db_name='hongye'
*.db_recovery_file_dest='/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=hongyeXDB)'
*.job_queue_processes=10
*.nls_date_format='yyyy-mm-dd hh24:mi:ss'
*.open_cursors=30
*.pga_aggregate_target=16777216
*.processes=100
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=70
*.sga_target=100M
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/admin/hongye/udump'
~
~
"inithongye2.ora" 23L, 854C written
[oracle@ORA10G2 dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwdhongye

Enter password for SYS:
[oracle@ORA10G2 dbs]$ ll
total 32
-rw-r--r--  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall   854 Feb 18 10:49 inithongye.ora
-rw-r-----  1 oracle oinstall  2469 Feb 11 20:59 init.ora
-rw-r-----  1 oracle oinstall  1536 Feb 18 10:49 orapwdhongye
-rw-r-----  1 oracle oinstall   694 Feb 17 19:34 sqlnet.log

[oracle@ORA10G2 dbs]$ mkdir /oracle/admin/hongye/
[oracle@ORA10G2 dbs]$ cd /oracle/admin/hongye/
[oracle@ORA10G2 hongye]$ mkdir adump bdump cdump udump
[oracle@ORA10G2 dbs]$ dbs
[oracle@ORA10G2 dbs]$ ll /oracle/oradata/hongye/
total 0
[oracle@ORA10G2 dbs]$ sql

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 18 10:54:19 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

IDLE > conn /as sysdba
Connected to an idle instance.
IDLE > startup nomount
ORACLE instance started.

Total System Global Area  104857600 bytes
Fixed Size                  1272216 bytes
Variable Size              58721896 bytes
Database Buffers           37748736 bytes
Redo Buffers                7114752 bytes
IDLE > exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ORA10G2 dbs]$ rman

Recovery Manager: Release 10.2.0.5.0 - Production on Fri Feb 18 10:55:04 2011

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

RMAN> connect target /

connected to target database: hongye (not mounted)

RMAN> restore controlfile from autobackup;

Starting restore at 18-FEB-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=101 devtype=DISK

recovery area destination: /oracle/flash_recovery_area
database name (or database unique name) used for search: HONGYE
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /oracle/flash_recovery_area/HONGYE/autobackup/2011_02_17/o1_mf_s_743368844_6ot14fh2_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/oracle/oradata/hongye/control01.ctl
output filename=/oracle/oradata/hongye/control02.ctl
output filename=/oracle/oradata/hongye/control03.ctl
Finished restore at 18-FEB-11

RMAN> sql "alter database mount";

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 18-FEB-11
Starting implicit crosscheck backup at 18-FEB-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=101 devtype=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 18-FEB-11

Starting implicit crosscheck copy at 18-FEB-11
using channel ORA_DISK_1
Finished implicit crosscheck copy at 18-FEB-11

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /oracle/flash_recovery_area/HONGYE/autobackup/2011_02_17/o1_mf_s_743368844_6ot14fh2_.bkp

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 00001 to /oracle/oradata/hongye/system01.dbf
restoring datafile 00002 to /oracle/oradata/hongye/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/hongye/sysaux01.dbf
restoring datafile 00004 to /oracle/oradata/hongye/users01.dbf
restoring datafile 00005 to /oracle/oradata/hongye/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp tag=TAG20110217T191915
channel ORA_DISK_1: restore complete, elapsed time: 00:02:29
Finished restore at 18-FEB-11

RMAN> recover database;

Starting recover at 18-FEB-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=101 devtype=DISK

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=2
channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp tag=TAG20110217T192041
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
archive log filename=/oracle/flash_recovery_area/HONGYE/archivelog/2011_02_18/o1_mf_1_2_6ovrcsyb_.arc thread=1 sequence=2
channel default: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/HONGYE/archivelog/2011_02_18/o1_mf_1_2_6ovrcsyb_.arc recid=3 stamp=743425422
unable to find archive log
archive log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/18/2011 11:03:49
RMAN-06054: media recovery requesting unknown log: thread 1 seq 3 lowscn 1219581

RMAN> recover database;

Starting recover at 18-FEB-11
using channel ORA_DISK_1

starting media recovery

unable to find archive log
archive log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/18/2011 11:04:04
RMAN-06054: media recovery requesting unknown log: thread 1 seq 3 lowscn 1219581

RMAN> exit


Recovery Manager complete.
[oracle@ORA10G2 dbs]$ sql

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 18 11:04:26 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

IDLE > conn /as sysdba
Connected.
SYS:101@hongye > select open_mode from v$database;

OPEN_MODE
----------
MOUNTED

SYS:101@hongye > alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SYS:101@hongye > alter database open resetlogs;

Database altered.

SYS:101@hongye > select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

SYS:101@hongye > @get_allfile

TYPE                FILE_NAME                                                                 SIZE_MB
------------------- ---------------------------------------------------------------------- ----------
Datafile ........  /oracle/oradata/hongye/system01.dbf                                           600
Datafile ........  /oracle/oradata/hongye/undotbs01.dbf                                          405
Datafile ........  /oracle/oradata/hongye/sysaux01.dbf                                           300
Datafile ........  /oracle/oradata/hongye/users01.dbf                                             20
Datafile ........  /oracle/oradata/hongye/example01.dbf                                          100

TempFile ........  /oracle/oradata/hongye/temp01.dbf                                              20
TempFile ........  /oracle/oradata/hongye/temp02.dbf                                              30

Logfile .........  /oracle/oradata/hongye/redo03.log                                              50
Logfile .........  /oracle/oradata/hongye/redo02.log                                              50
Logfile .........  /oracle/oradata/hongye/redo01.log                                              50

Controlfile .....  /oracle/oradata/hongye/control01.ctl                                            7
Controlfile .....  /oracle/oradata/hongye/control02.ctl                                            7
Controlfile .....  /oracle/oradata/hongye/control03.ctl                                            7


13 rows selected.

SYS:101@hongye > show parameter compa

NAME                                 TYPE                VALUE
------------------------------------ ------------------- ------------------------------
compatible                           string              10.2.0.5.0

plsql_v2_compatibility               boolean             FALSE

SYS:101@hongye > exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ORA10G2 dbs]$ su -
Password:
[root@ORA10G2 ~]# umount /oracle/flash_recovery_area/
[root@ORA10G2 ~]# exit
logout
[oracle@ORA10G2 dbs]$ rman

Recovery Manager: Release 10.2.0.5.0 - Production on Fri Feb 18 11:06:20 2011

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

RMAN> connect target /

connected to target database: HONGYE (DBID=2424037643)

RMAN> list backup summary;

using target database control file instead of recovery catalog

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  A  A DISK        17-FEB-11       1       1       NO         TAG20110217T191909
2       B  F  A DISK        17-FEB-11       1       1       NO         TAG20110217T191915
3       B  A  A DISK        17-FEB-11       1       1       NO         TAG20110217T192041
4       B  F  A DISK        17-FEB-11       1       1       NO         TAG20110217T192044
5       B  F  A DISK        18-FEB-11       1       1       NO         TAG20110218T110520

RMAN> crosscheck backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=84 devtype=DISK
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T191909_6ot11hkl_.bkp recid=1 stamp=743368751
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp recid=2 stamp=743368755
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp recid=3 stamp=743368842
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/HONGYE/autobackup/2011_02_17/o1_mf_s_743368844_6ot14fh2_.bkp recid=4 stamp=743424966
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/HONGYE/autobackup/2011_02_18/o1_mf_n_743425520_6ovrho1r_.bkp recid=5 stamp=743425524
Crosschecked 5 objects

RMAN> delete expired backup;

using channel ORA_DISK_1

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   EXPIRED     DISK        /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T191909_6ot11hkl_.bkp
2       2       1   1   EXPIRED     DISK        /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp
3       3       1   1   EXPIRED     DISK        /oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp
4       4       1   1   EXPIRED     DISK        /oracle/flash_recovery_area/HONGYE/autobackup/2011_02_17/o1_mf_s_743368844_6ot14fh2_.bkp
5       5       1   1   EXPIRED     DISK        /oracle/flash_recovery_area/HONGYE/autobackup/2011_02_18/o1_mf_n_743425520_6ovrho1r_.bkp

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T191909_6ot11hkl_.bkp recid=1 stamp=743368751
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_nnndf_TAG20110217T191915_6ot11mbc_.bkp recid=2 stamp=743368755
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_17/o1_mf_annnn_TAG20110217T192041_6ot14bjm_.bkp recid=3 stamp=743368842
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/HONGYE/autobackup/2011_02_17/o1_mf_s_743368844_6ot14fh2_.bkp recid=4 stamp=743424966
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/HONGYE/autobackup/2011_02_18/o1_mf_n_743425520_6ovrho1r_.bkp recid=5 stamp=743425524
Deleted 5 EXPIRED objects


RMAN> list backup summary;


RMAN> backup database;

Starting backup at 18-FEB-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/hongye/system01.dbf
input datafile fno=00002 name=/oracle/oradata/hongye/undotbs01.dbf
input datafile fno=00003 name=/oracle/oradata/hongye/sysaux01.dbf
input datafile fno=00005 name=/oracle/oradata/hongye/example01.dbf
input datafile fno=00004 name=/oracle/oradata/hongye/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-FEB-11
channel ORA_DISK_1: finished piece 1 at 18-FEB-11
piece handle=/oracle/flash_recovery_area/HONGYE/backupset/2011_02_18/o1_mf_nnndf_TAG20110218T110746_6ovrn332_.bkp tag=TAG20110218T110746 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26
Finished backup at 18-FEB-11

Starting Control File Autobackup at 18-FEB-11
piece handle=/oracle/flash_recovery_area/HONGYE/autobackup/2011_02_18/o1_mf_n_743425752_6ovrpspq_.bkp comment=NONE
Finished Control File Autobackup at 18-FEB-11

RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
6       B  F  A DISK        18-FEB-11       1       1       NO         TAG20110218T110746
7       B  F  A DISK        18-FEB-11       1       1       NO         TAG20110218T110912

RMAN> exit


Recovery Manager complete.
[oracle@ORA10G2 dbs]$

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24465008/viewspace-688035/,如需轉載,請註明出處,否則將追究法律責任。

相關文章