同機同版本資料庫從檔案系統遷移至ASM實驗
1. 實驗環境說明
作業系統的版本是Oracle Linux 5核心是2.6.18-164.el5
[[email protected] ~]# uname -a
Linux book 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT 2009 i686 i686 i386 GNU/Linux
Oracle資料庫的版本是:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
本機已經建立了ASM例項
[[email protected] ~]$ echo $ORACLE_SID
+ASM
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 3 23:00:14 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select name,total_mb,free_mb from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
DGROUP01 3579 2580
檔案系統資料庫例項說明
[[email protected] ~]$ export ORACLE_SID=practice
[[email protected] ~]$ echo $ORACLE_SID
practice
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 3 23:04:22 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select name from v$database;
NAME
---------
PRACTICE
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/practice/system01.dbf
/u01/app/oracle/oradata/practice/undotbs01.dbf
/u01/app/oracle/oradata/practice/sysaux01.dbf
/u01/app/oracle/oradata/practice/users01.dbf
/u01/app/oracle/oradata/practice/users02.dbf
/u01/app/oracle/oradata/practice/tools01.dbf
/u01/app/oracle/oradata/practice/ts4drop01.dbf
7 rows selected.
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/practice/control01.ctl
/u01/app/oracle/oradata/practice/control02.ctl
/u01/app/oracle/oradata/practice/control03.ctl
/home/oracle/flash_recover_area/HEADDB/control_file/control04.ctl
/home/oracle/flash_recover_area/HEADDB/control_file/control05.ctl
/home/oracle/flash_recover_area/HEADDB/control_file/control06.ctl
6 rows selected.
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/practice/temp01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/practice/redo031.log
/u01/app/oracle/oradata/practice/redo021.log
/u01/app/oracle/oradata/practice/redo011.log
/home/oracle/flash_recover_area/practice/logfile/redo012.log
/home/oracle/flash_recover_area/practice/logfile/redo022.log
/home/oracle/flash_recover_area/practice/logfile/redo032.log
6 rows selected.
2. 備份檔案系統資料庫
[[email protected] ~]$ echo $ORACLE_SID
practice
[[email protected] ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 3 22:26:27 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: PRACTICE (DBID=2994901982)
RMAN> list backup;
RMAN> backup database plus archivelog delete all input;
Starting backup at 03-FEB-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=1 stamp=804288718
input archive log thread=1 sequence=2 recid=2 stamp=804299193
input archive log thread=1 sequence=3 recid=3 stamp=804306343
input archive log thread=1 sequence=4 recid=4 stamp=804306840
input archive log thread=1 sequence=5 recid=5 stamp=804308863
channel ORA_DISK_1: starting piece 1 at 03-FEB-13
channel ORA_DISK_1: finished piece 1 at 03-FEB-13
piece handle=/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_annnn_TAG20130203T222943_8jwx2v5p_.bkp tag=TAG20130203T222943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:40
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_09/o1_mf_1_1_8gtwb349_.arc recid=1 stamp=804288718
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_10/o1_mf_1_2_8gv6kpxb_.arc recid=2 stamp=804299193
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_10/o1_mf_1_3_8gvfk6mw_.arc recid=3 stamp=804306343
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_10/o1_mf_1_4_8gvg0rt7_.arc recid=4 stamp=804306840
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_10/o1_mf_1_5_8gvhzzmw_.arc recid=5 stamp=804308863
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=6 stamp=804747422
input archive log thread=1 sequence=2 recid=7 stamp=804749079
input archive log thread=1 sequence=3 recid=8 stamp=804749153
input archive log thread=1 sequence=4 recid=9 stamp=804749448
input archive log thread=1 sequence=5 recid=10 stamp=804749622
input archive log thread=1 sequence=6 recid=11 stamp=806452181
channel ORA_DISK_1: starting piece 1 at 03-FEB-13
channel ORA_DISK_1: finished piece 1 at 03-FEB-13
piece handle=/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_annnn_TAG20130203T222943_8jwx6c7r_.bkp tag=TAG20130203T222943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:10
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_15/o1_mf_1_1_8h8w8vxw_.arc recid=6 stamp=804747422
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_15/o1_mf_1_2_8h8xwqpo_.arc recid=7 stamp=804749079
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_15/o1_mf_1_3_8h8xz1dq_.arc recid=8 stamp=804749153
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_15/o1_mf_1_4_8h8y888s_.arc recid=9 stamp=804749448
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_01_15/o1_mf_1_5_8h8yfox8_.arc recid=10 stamp=804749622
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_02_03/o1_mf_1_6_8jwx29l6_.arc recid=11 stamp=806452181
Finished backup at 03-FEB-13
Starting backup at 03-FEB-13
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=/u01/app/oracle/oradata/practice/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/practice/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/practice/undotbs01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/practice/users02.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/practice/tools01.dbf
input datafile fno=00007 name=/u01/app/oracle/oradata/practice/ts4drop01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/practice/users01.dbf
channel ORA_DISK_1: starting piece 1 at 03-FEB-13
channel ORA_DISK_1: finished piece 1 at 03-FEB-13
piece handle=/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_nnndf_TAG20130203T223152_8jwx6y2q_.bkp tag=TAG20130203T223152 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:43
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 03-FEB-13
channel ORA_DISK_1: finished piece 1 at 03-FEB-13
piece handle=/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_ncsnf_TAG20130203T223152_8jwxg0j3_.bkp tag=TAG20130203T223152 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:23
Finished backup at 03-FEB-13
Starting backup at 03-FEB-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=12 stamp=806452564
channel ORA_DISK_1: starting piece 1 at 03-FEB-13
channel ORA_DISK_1: finished piece 1 at 03-FEB-13
piece handle=/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_annnn_TAG20130203T223607_8jwxgrv1_.bkp tag=TAG20130203T223607 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/PRACTICE/archivelog/2013_02_03/o1_mf_1_7_8jwxgng2_.arc recid=12 stamp=806452564
Finished backup at 03-FEB-13
RMAN> list backup;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
4 11.92M DISK 00:00:07 03-FEB-13
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20130203T222943
Piece Name: /u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_annnn_TAG20130203T222943_8jwx6c7r_.bkp
List of Archived Logs in backup set 4
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 1 474409 10-JAN-13 499157 15-JAN-13
1 2 499157 15-JAN-13 500057 15-JAN-13
1 3 500057 15-JAN-13 500084 15-JAN-13
1 4 500084 15-JAN-13 500198 15-JAN-13
1 5 500198 15-JAN-13 500417 15-JAN-13
1 6 500417 15-JAN-13 504497 03-FEB-13
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 512.37M DISK 00:03:38 03-FEB-13
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20130203T223152
Piece Name: /u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_nnndf_TAG20130203T223152_8jwx6y2q_.bkp
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/system01.dbf
2 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/undotbs01.dbf
3 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/sysaux01.dbf
4 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/users01.dbf
5 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/users02.dbf
6 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/tools01.dbf
7 Full 504516 03-FEB-13 /u01/app/oracle/oradata/practice/ts4drop01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 6.80M DISK 00:00:12 03-FEB-13
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20130203T223152
Piece Name: /u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_ncsnf_TAG20130203T223152_8jwxg0j3_.bkp
Control File Included: Ckp SCN: 504566 Ckp time: 03-FEB-13
SPFILE Included: Modification time: 03-FEB-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7 484.00K DISK 00:00:02 03-FEB-13
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20130203T223607
Piece Name: /u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_annnn_TAG20130203T223607_8jwxgrv1_.bkp
List of Archived Logs in backup set 7
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 7 504497 03-FEB-13 504603 03-FEB-13
3. 關閉檔案系統資料庫例項
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create pfile from spfile;
File created.
後面我們要修改控制檔案的位置指向,SPFILE是二進位制檔案,無法直接修改,我們先創建出一個pfile檔案,然後修改pfile。當然也可以在還沒有關閉資料庫的時候執行如下命令:
Alter database set control_files=’+ DGROUP01’ scope=spfile;
然後再關閉資料庫,設定即可生效。這裡採用直接修改pfile的方式。
4. 修改引數檔案
首先把檔案系統的SPFILE備份
[[email protected] dbs]$ mv spfilepractice.ora spfilepractice.orabak
修改practice例項的引數檔案,使其控制檔案指向ASM
[[email protected] dbs]$ vi initpractice.ora
practice.__db_cache_size=494927872
practice.__java_pool_size=4194304
practice.__large_pool_size=4194304
practice.__shared_pool_size=226492416
practice.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/practice/adump'
*.background_dump_dest='/u01/app/oracle/admin/practice/bdump'
*.compatible='10.2.0.1.0'
*.control_files='+DGROUP01/practice/controlfile/control01.ctl','+DGROUP01/practice/controlfile/control02.ctl','+DGROUP01/practice/controlfile/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/practice/cdump'
*.db_block_size=8192
*.db_domain='oracle.com'
*.db_file_multiblock_read_count=16
*.db_name='practice'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=5368709120
*.dispatchers='(PROTOCOL=TCP) (SERVICE=practiceXDB)'
*.fast_start_mttr_target=3600
*.job_queue_processes=10
*.log_archive_format='ARC%S_%R.%T.dbf'
*.open_cursors=300
*.pga_aggregate_target=314572800
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=734003200
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/practice/udump'
5. 檢查ASM例項的狀態
[[email protected] ~]$ echo $ORACLE_SID
+ASM
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 3 23:39:12 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select name,total_mb,free_mb from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
DGROUP01 3579 2580
6. 恢復待遷移例項的控制檔案
[[email protected] ~]$ echo $ORACLE_SID
practice
[[email protected] ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Feb 3 23:42:13 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 734003200 bytes
Fixed Size 1221564 bytes
Variable Size 234884164 bytes
Database Buffers 494927872 bytes
Redo Buffers 2969600 bytes
RMAN> restore controlfile from '/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_ncsnf_TAG20130203T223152_8jwxg0j3_.bkp';
Starting restore at 03-FEB-13
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:30
output filename=+DGROUP01/practice/controlfile/control01.ctl
output filename=+DGROUP01/practice/controlfile/control02.ctl
output filename=+DGROUP01/practice/controlfile/control03.ctl
Finished restore at 03-FEB-13
我們再去ASM磁碟組中看看控制檔案是否已經遷移至ASM中
[[email protected] ~]$ asmcmd
ASMCMD> pwd
+
ASMCMD> ls /DGROUP01/PRACTICE/CONTROLFILE/
Current.266.806456845
control01.ctl
control02.ctl
control03.ctl
current.267.806456853
current.268.806456857
這些控制檔案已經遷移成功。
7. 恢復資料庫
控制檔案恢復以後,就可以把資料庫起到mount狀態。
SQL> alter database mount;
Database altered.
在RMAN視窗中執行如下命令來恢復資料檔案:
RMAN> run{
2> set newname for datafile 1 to '+DGROUP01';
3> set newname for datafile 2 to '+DGROUP01';
4> set newname for datafile 3 to '+DGROUP01';
5> set newname for datafile 4 to '+DGROUP01';
6> set newname for datafile 5 to '+DGROUP01';
7> set newname for datafile 6 to '+DGROUP01';
8> set newname for datafile 7 to '+DGROUP01';
9> restore database;
10> switch datafile all;
11> recover database;
12> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 04-FEB-13
using channel ORA_DISK_1
channel ORA_DISK_1: restoring datafile 00002
input datafile copy recid=5 stamp=806463586 filename=+DGROUP01/practice/datafile/undotbs1.271.806463507
destination for restore of datafile 00002: +DGROUP01
channel ORA_DISK_1: copied datafile copy of datafile 00002
output filename=+DGROUP01/practice/datafile/undotbs1.270.806463833 recid=6 stamp=806463842
channel ORA_DISK_1: restoring datafile 00004
input datafile copy recid=1 stamp=806463533 filename=+DGROUP01/practice/datafile/users.274.806463523
destination for restore of datafile 00004: +DGROUP01
channel ORA_DISK_1: copied datafile copy of datafile 00004
output filename=+DGROUP01/practice/datafile/users.269.806463849 recid=7 stamp=806463849
channel ORA_DISK_1: restoring datafile 00006
input datafile copy recid=3 stamp=806463581 filename=+DGROUP01/practice/datafile/tools.272.806463517
destination for restore of datafile 00006: +DGROUP01
channel ORA_DISK_1: copied datafile copy of datafile 00006
output filename=+DGROUP01/practice/datafile/tools.275.806463851 recid=8 stamp=806463852
channel ORA_DISK_1: restoring datafile 00007
input datafile copy recid=4 stamp=806463582 filename=+DGROUP01/practice/datafile/ts4frop.273.806463521
destination for restore of datafile 00007: +DGROUP01
channel ORA_DISK_1: copied datafile copy of datafile 00007
output filename=+DGROUP01/practice/datafile/ts4frop.276.806463855 recid=9 stamp=806463855
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DGROUP01
restoring datafile 00003 to +DGROUP01
restoring datafile 00005 to +DGROUP01
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_nnndf_TAG20130203T223152_8jwx6y2q_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/PRACTICE/backupset/2013_02_03/o1_mf_nnndf_TAG20130203T223152_8jwx6y2q_.bkp tag=TAG20130203T223152
channel ORA_DISK_1: restore complete, elapsed time: 00:05:16
Finished restore at 04-FEB-13
datafile 1 switched to datafile copy
input datafile copy recid=13 stamp=806464172 filename=+DGROUP01/practice/datafile/system.277.806463857
datafile 2 switched to datafile copy
input datafile copy recid=14 stamp=806464173 filename=+DGROUP01/practice/datafile/undotbs1.270.806463833
datafile 3 switched to datafile copy
input datafile copy recid=15 stamp=806464173 filename=+DGROUP01/practice/datafile/sysaux.278.806463859
datafile 4 switched to datafile copy
input datafile copy recid=16 stamp=806464173 filename=+DGROUP01/practice/datafile/users.269.806463849
datafile 5 switched to datafile copy
input datafile copy recid=17 stamp=806464173 filename=+DGROUP01/practice/datafile/users.279.806463861
datafile 6 switched to datafile copy
input datafile copy recid=18 stamp=806464173 filename=+DGROUP01/practice/datafile/tools.275.806463851
datafile 7 switched to datafile copy
input datafile copy recid=19 stamp=806464173 filename=+DGROUP01/practice/datafile/ts4frop.276.806463855
Starting recover at 04-FEB-13
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 7 is already on disk as file /home/oracle/flash_recover_area/practice/logfile/redo012.log
archive log thread 1 sequence 8 is already on disk as file /home/oracle/flash_recover_area/practice/logfile/redo022.log
archive log filename=/home/oracle/flash_recover_area/practice/logfile/redo012.log thread=1 sequence=7
archive log filename=/home/oracle/flash_recover_area/practice/logfile/redo022.log thread=1 sequence=8
media recovery complete, elapsed time: 00:00:25
Finished recover at 04-FEB-13
資料檔案都恢復之後就可以開啟資料庫了,因為使用的是備份集中恢復回來的控制檔案,開啟資料庫時,必須要加上resetlogs選項。
SQL> select * from v$recover_file;
no rows selected
SQL> alter database open resetlogs;
Database altered.
8. 遷移日誌檔案
首先檢視當前的日誌檔案的狀態
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 UNUSED
2 CURRENT
3 UNUSED
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- ----------------------------------------------------------------------
3 /u01/app/oracle/oradata/practice/redo031.log
2 /u01/app/oracle/oradata/practice/redo021.log
1 /u01/app/oracle/oradata/practice/redo011.log
1 /home/oracle/flash_recover_area/practice/logfile/redo012.log
2 /home/oracle/flash_recover_area/practice/logfile/redo022.log
3 /home/oracle/flash_recover_area/practice/logfile/redo032.log
從以上資訊判斷,目前日誌檔案都在檔案系統中,並且只有日誌組2部可以刪除。我們先刪除可以刪除的組,然後在ASM中新增新的日誌組,以此達到遷移的目的。
SQL> alter database drop logfile group 1;
Database altered.
SQL> alter database add logfile group 1 '+DGROUP01' size 50M;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
SQL> alter database add logfile group 3 '+DGROUP01' size 50M;
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 UNUSED
2 CURRENT
3 UNUSED
現在還需要刪除group2,先執行一次日誌切換
SQL> alter system switch logfile;
System altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CURRENT
2 ACTIVE
3 UNUSED
現在group2是active狀態,讓系統生成以此檢查點
SQL> alter system checkpoint;
System altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CURRENT
2 INACTIVE
3 UNUSED
現在可以刪除了。
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter database add logfile group 2 '+DGROUP01' size 50M;
Database altered.
SQL> select member from v$logfile;
MEMBER
----------------------------------------------------------------------
+DGROUP01/practice/onlinelog/group_3.281.806469935
+DGROUP01/practice/onlinelog/group_2.282.806470267
+DGROUP01/practice/onlinelog/group_1.280.806465581
9. 遷移臨時檔案
檢視臨時檔案當前的位置
SQL> select name from v$tempfile;
NAME
------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/practice/temp01.dbf
可以先給temp表空間增加一個位於ASM的臨時資料檔案,再刪除位於檔案系統的臨時檔案。
SQL> alter tablespace temp add tempfile '+DGROUP01' size 20M;
Tablespace altered.
SQL> select name from v$tempfile;
NAME
------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/practice/temp01.dbf
+DGROUP01/practice/tempfile/temp.283.806470587
SQL> alter tablespace temp drop tempfile '/u01/app/oracle/oradata/practice/temp01.dbf';
Tablespace altered.
SQL> select name from v$tempfile;
NAME
------------------------------------------------------------------------------------------------------------------------
+DGROUP01/practice/tempfile/temp.283.806470587
10. 檢查遷移結果
SQL> select name from v$datafile;
NAME
------------------------------------------------------------------------------------------------------------------------
+DGROUP01/practice/datafile/system.277.806463857
+DGROUP01/practice/datafile/undotbs1.270.806463833
+DGROUP01/practice/datafile/sysaux.278.806463859
+DGROUP01/practice/datafile/users.269.806463849
+DGROUP01/practice/datafile/users.279.806463861
+DGROUP01/practice/datafile/tools.275.806463851
+DGROUP01/practice/datafile/ts4frop.276.806463855
7 rows selected.
SQL> select name from v$controlfile;
NAME
------------------------------------------------------------------------------------------------------------------------
+DGROUP01/practice/controlfile/control01.ctl
+DGROUP01/practice/controlfile/control02.ctl
+DGROUP01/practice/controlfile/control03.ctl
SQL> select member from v$logfile;
MEMBER
----------------------------------------------------------------------
+DGROUP01/practice/onlinelog/group_3.281.806469935
+DGROUP01/practice/onlinelog/group_2.282.806470267
+DGROUP01/practice/onlinelog/group_1.280.806465581
SQL> select name from v$tempfile;
NAME
------------------------------------------------------------------------------------------------------------------------
+DGROUP01/practice/tempfile/temp.283.806470587
至此,資料檔案、控制檔案、日誌檔案、臨時檔案都已遷移至ASM中,遷移完成
相關推薦
同機同版本資料庫從檔案系統遷移至ASM實驗
1. 實驗環境說明 作業系統的版本是Oracle Linux 5核心是2.6.18-164.el5 [[email protected] ~]# uname -a Linux book 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:4
oracle資料庫檔案系統遷移到ASM
檢視ASM磁碟組 SQL> select name,state from v$asm_diskgroup; 登陸RMAN執行映象全備到ASM磁碟組 $rman target /RMAN> backup as copy database format '+da
oracle表空間檔案系統遷移到ASM
1.配置測試環境建立資料表空間create tablespace test logging datafile '/home/oracle/test.dbf' size 10m autoextend on next 10m maxsize 2048m extent management local;建立使用者並
Oracle遷移資料檔案從檔案系統至裸裝置
實施將檔案系統上的資料檔案移至裸裝置上: 進入sqlplus命令列: $ sqlplus '/as sysdba' SQL*Plus: Release 9.2.0.6.0 - Production on Thu Aug 19 19:52:32 2010 Copyright (c) 1982, 2002, O
如何從檔案系統中讀取檔案內容
【0】寫在前面 0.0) text description from orange’s implemention of a os ,文末總結繫個人臆測出的乾貨 【1】intro to F
最全面的I/O優化介紹 從檔案系統到磁碟管理
1、系統學習 IO效能對於一個系統的影響是至關重要的。一個系統經過多項優化以後,瓶頸往往落在資料庫;而資料庫經過多種優化以後,瓶頸最終會落到IO。而IO效能的發展,明顯落後於CPU的發展。Memchached也好,NoSql也好,這些流行技術的背後都在直接或者間接地迴
資料庫和檔案系統的快照snapshot
1.快照用途 通俗法:快照的作用主要是能夠進行線上資料恢復,用資料庫採集下系統某一時刻的資料,將資料存入資料庫中,當儲存裝置發生應用故障或者檔案損壞時可以進行及時資料恢復,將資料恢復成快照產生時間點的狀態。快照的另一個作用是為儲存使用者提供了另外一個數據訪問通道,當原資料進
ASM+RAC==>>單例項+檔案系統遷移步驟
1修改pfile檔案(去掉叢集專用,因原伺服器有重名資料庫,取別名'test') 2轉儲控制檔案,資料庫至mount 3註冊備份集目錄 4restore、recover database 5修改redo日誌路徑 6開啟資料庫7善後(刪除多餘undo和redo、新建temp表
oracle表空間文件系統遷移到ASM
備份 value local lec max num 文件系統 space get 1.配置測試環境創建數據表空間create tablespace test logging datafile ‘/home/oracle/test.dbf‘ size 10m autoext
Petit FatFs檔案系統移植至STC89C52RC
MCU:STC89C51RC 最高主頻:80M Flash:4K SRAM:512B EEPROM:4K 系統:Petit FatFs 整合開發環境:keil 4 今天將Petit FatFs成功掛載到STC89C52RC晶片上進行執行,實話說這樣做的意義並不
阿裏雲從IPSec隧道遷移至物理專線
ces 架設 地址 ima 網段 打通 blog 添加 圖片 我司雲上網絡采用的是螞蟻金融雲。原先由於專線沒有架設,業務建設刻不容緩,於是我司技術上采用IPSec公網隧道臨時將雲上雲下網絡打通。由於近期發現IPSec隧道不穩定,且因為兼容原因導致部分數據時斷時續。因此,我司
將spfile由本地遷移至ASM
前幾天犯了一個錯誤,重建spfile時使用了create spfile from pfile='...'; 實際上應該用create spfile='...' from pfile='...'; 修改: SQL> startup nomount pfile='/tmp
使用RMAN遷移檔案系統資料庫到ASM
--================================== -- 使用RMAN遷移檔案系統數據庫到ASM --================================== 在
使用vmware vconverter從物理機遷移系統到虛擬機P2V(多圖)
ensure 網卡通信 src block 用戶界面 vswitch sp2 winrar select zhuan:https://segmentfault.com/a/1190000002697929 本文完整記錄了如何從物理服務器,保持所有環境配置信息,紋絲不
不刪除資料情況下轉換檔案系統型別,從FAT32轉到NTFS
轉換檔案系統型別,從FAT32轉到NTFS(不刪除資料) 如果是從NTFS轉FAT32就不能用下面的方法,需要備份你的資料之後再格式化 最近下完電影想把電影傳到U盤裡,結果顯示檔案過大不能傳,然後看了看我的U盤屬性是FAT32,FAT32是不支援4G以上的檔案傳輸的,所以需要改變
Linux系統下Oracle資料庫dmp檔案匯出與匯入
1.建立表空間 su - oracle create tablespace demo_new_data datafile '${ORACLE_HOME}\oradata\demo_new_data.dbf' size 500M reuse autoextend on next 40M exte
檔案系統損壞,oracle資料庫恢復
今天接到一個客戶的服務請求,由於伺服器被強制重啟,資料庫無法啟動ORA-1200報錯 這是一個常見的ORA-1200錯誤,但是檔案大小相差的有離譜實際大小729600個block,但是現在只有149760個block.不像是一般主機重啟導致的資料庫異常.通過再次諮詢客戶實際是什麼情況,客戶那邊如實描述:
SqlServer低版本資料庫附加Sql高版本資料庫或備份檔案
SqlServer低版本資料庫不能直接還原或附加Sql高版本資料庫或備份檔案,我們常用DTS互導的方式,如果不同版本資料庫不可訪問,可以使用高版本資料庫的DTS匯出整個庫的相應低版本建庫指令碼與資料,然後放在低版本資料庫中去執行,常見如
sqoop在關係型資料庫與分散式檔案系統之間傳輸資料
sqoop用於 hadoop 與關係型資料庫之間的資料傳遞,可以將資料庫中的資料匯入到hdfs等檔案系統,也可以將hdfs 上的資料匯入到資料庫中。 準備sqoop 軟體包 sqoop-1.4.7.bin__hadoop-2.6.0 http://archive.apache.org
大量資料遷移到物件儲存服務過程中使用聯合檔案系統的遷移方案
記一次遷移3T靜態資料到儲存服務的實踐過程,跟大家分享一下。 剛畢業,水平有限,重在記錄和分享。^ _ ^ 1.任務概述 幾個T的靜態資料遷移,主要是小圖,從本地檔案系統遷移到新物件儲存服務中。 遷移過程時間跨度大,可能要幾天甚至一週才能完成,在這過程