Database migration: migrate the file system to ASM

Source: Internet
Author: User
Database migration: migrate the file system to the ASM system environment: Operating System: AIX5.3-08 Oracle: Oracle10gR21. perform the operation and select a feasible migration solution. 2. Preparations, create an ASM disk group and start an ASM instance. 3. medium stage: complete the migration of parameter files, control files, and data files. 4. Complete the temporary table blank.

Database migration: File System to the ASM system environment: Operating System: AIX5.3-08 Oracle: Oracle 10gR2 1, the implementation of the operation, select the feasibility of the migration solution; 2, preliminary: preparation, create an ASM disk group and start an ASM instance. 3. medium stage: complete the migration of parameter files, control files, and data files. 4. Complete the temporary table blank.

Database migration: migrate the file system to ASM

System Environment:

Operating System: AIX5.3-08

Oracle: Oracle 10gR2

1. perform the operation and select a feasible migration solution;

2. Preparation: Create an ASM disk group and start an ASM instance;

3. Middle Stage: migration of parameter files, control files, and data files;

4. Later Stage: migrate temporary tablespace and log files.

**************************************** **************************************** *********

* Preliminary objective: to configure ASM, create an ASM disk group, and start an ASM instance

**************************************** **************************************** *********

: //: <8> volslice list -- view the array disk partition

: //: <1> volslice createaix203_asm-z 10 gb t01

-- Divides 10 Gb of disk space from the disk array to migrate the oracle File System

# Lsdev | grep-I ada-find the host's Optical Fiber adapter to bind the disk to the array

Ent2 Available 14-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)

Fcs0 Available 1D-08 FC Adapter

Fda0 Available 01-D1 Standard I/O Diskette Adapter

# Lscfg-vpl fcs0 -- find the network address of the Optical Fiber adapter

Device Specific. (ZM) ...... 3

NetworkAddress...

ROS Level and ID... 02881914

: //: <> Lun perm lun 10 rwwwn 0000000c946257e

-- Bind the new array disk space 10 to the Optical Fiber adapter and set the permission to readable and writable.

# Cfgmgr-v

-- After a device is added, it cannot be read directly. You need to execute this command to read the ODM database to find the configuration and driver information of the Newly Added Disk.

-- This command is automatically executed when the host is restarted.

-- During this implementation, the newly added Array Device is identified only after you manually execute this command and restart the host.

# Lsdev-c disk -- check whether the newly added array disk is successfully identified. hdisk2 is the newly added disk device.

Hdisk0 Available 1S-08-00-8, 0 Other SCSI Disk Drive

Hdisk1 Available 1D-08-02 OtherFC SCSI Disk Drive

Hdisk2Available 1D-08-02 Other fc scsi DiskDrive

#

# Smit vg -- use the smit command to create a volume group oradata on the newly added array device, and set the pp size to 64 MB.

-- Create a logical volume disk1, disk2, and disk3 on the new volume group, with a size of 3 GB (48 pp)

# Mklv-y disk1-t raw oradata 48 hdisk2;

# Mklv-y disk2-t raw oradata 48 hdisk2;

# Mklv-y disk3-t raw oradata 48 hdisk2;

# Cd/dev -- enter the Device directory/dev

# Chown oracle: oinstall rdisk * -- change the owner of the created bare Device

# Chmod 660 rdisk * -- modify the access permission for the created bare Device

# Ls-l | grep rdisk -- view the modified bare device permission

Crw-rw ---- 1 oracle oinstall 51, 1 May 29 17:43 rdisk1

Crw-rw ---- 1 oracle oinstall 51, 2 May 29 17:43 rdisk2

Crw-rw ---- 1 oracle oinstall 51, 3 May 29 17:43 rdisk3

$ Cd/u01/app/oracle/product/10.2.0/db_1/dbs/-- initialize the parameter path as an oracle user

$ Vi init + ASM. ora -- edit the ASM initialization parameters

*. Background_dump_dest = '/u01/app/oracle/admin/+ ASM/bdump'

*. Core_dump_dest = '/u01/app/oracle/admin/+ ASM/cdump'

*. Instance_type = 'asm'

*. Large_pool_size = 12 M

*. Remote_login_passwordfile = 'shared'

*. User_dump_dest = '/u01/app/oracle/admin/+ ASM/udump'

$ Mkdir-p/u01/app/oracle/admin/+ ASM/udump -- create the udump directory and trace the user process.

$ Mkdir-p/u01/app/oracle/admin/+ ASM/bdump -- create the bdump directory and trace the background process

$ Mkdir-p/u01/app/oracle/admin/+ ASM/cdump -- create the cdump directory and the tracking directory of kernel Processes

# Cd/u01/app/oracle/product/10.2.0/db_1/bin

-- Run the localconfig script in the bin directory as root to start CSS

#./Localconfig delete -- run the clear script first.

StoppingCSSD.

Unableto communicate with the CSS daemon.

Shutdownhas begun. The daemons shoshould exit soon.

#./Localconfig add -- run the add script again.

Successfullyaccumulated necessary OCR keys.

CreatingOCR keys for user 'root', privgrp 'system '..

Operationsuccessful.

Configurationfor local CSS has been initialized

StaleCSS daemon is running... killing it now

Addingto inittab

Startupwill be queued to init within 30 seconds.

Checkingthe status of new Oracle init process...

Expectingthe CRS daemons to be up with within 600 seconds.

CSS isactive on these nodes.

Aix203

CSS isactive on all nodes.

OracleCSS service is installed and running under init (1 M)

[Oracle @ aix203] $ export ORACLE_SID = + ASM -- add the ASM instance name

[Oracle @ aix203] $ sqlplus '/as sysdba'

SQL> startup nomount; -- start the ASM instance to nomount

SQL> select instance_name, status from v $ instance; -- query the ASM instance status

INSTANCE_NAME STATUS

----------------------------

+ ASM STARTED

SQL> alter system set ASM_DISKSTRING = '/dev/rdisk *';

-- ASM_DISKSTRING parameter settings, so that ASM can find the raw device to create a disk group

-- Create an ASM disk group as DATA

SQL> create diskgroup DATA normalredundancy

2 FAILGROUP DATA1 disk '/dev/rdisk1'

3 FAILGROUP DATA2 disk '/dev/rdisk2'

4 FAILGROUP DATA3 disk '/dev/rdisk3 ';

SQL> alter diskgroup DATA check all; -- check the uniformity of the disk group

SQL> select name, state from v $ asm_diskgroup; -- view the disk group status, which has been mounted.

NAME STATE

-----------------------------------------

DATA MOUNTED

**************************************** **************************************** *********

* Medium-term objective: To prepare the original database for cold backup and use RMAN to dump files to ASM (parameter files, control files, and data files)

**************************************** **************************************** *********

-- Close the database and perform full backup for the database

SQL> create pfile = '/home/oracle/bak/initmetro. ora' from spfile; -- backup parameter file

SQL> shutdown immediate; -- close the database

SQL> startup mount; -- starts the database to the mount state and performs full backup once.

RMAN> backup full database format '/backup/datafile_bak/level0 _ % s _ % d. bak'; -- backup data file

RMAN> backup archivelog all format'/backup/arch_bak/arc _ % s _ % p _ % C ';

-- Archive files are backed up. Expired archive files are generated because useless archive files have been deleted before.

RMAN-00571: ========================================================== ==============================

RMAN-00569: ==================== error message stack follows ==========================

RMAN-00571: ========================================================== ==============================

RMAN-03002: failure of backup command at 05/29/2014 15:36:44

RMAN-06059: expected archived log not found, lost of archived log compromisesrecoverability

ORA-19625: error identifying file/arch/FIG _8211_190.dbf

ORA-27037: unable to obtain file status

Ibm aixrisc System/6000 Error: 2: No such file or directory

Additionalinformation: 3

RMAN> crosscheck archivelog all; -- check archiving continuity

Releasedchannel: ORA_DISK_1

Allocatedchannel: ORA_DISK_1

ChannelORA_DISK_1: sid = 132 devtype = DISK

Validationfailedfor archived log

Archivelog filename =/arch/Comment comment _8211_190.dbf recid = 191 stamp = 821547060

RMAN> delete expired archivelog all; -- delete expired Archives

RMAN> backup archivelog all format'/backup/arch_bak/arc _ % s _ % p _ % C ';

-- The archive file is backed up again and completed successfully.

SQL> startup nomount; -- starts the database to the nomount status

[Oracle @ aix203] $ rman target/-- log on to rman

-- Perform a cold backup and back up data to the ASM disk group

RMAN> run {

2> allocate channel c1 device type disk;

3> allocate channel c2 device type disk;

4> backup as copy database format = '+ data ';

5> release channel restart;

6> release channel ch2;

7>}

RMAN> restore spfile to '+ DATA/spfilemetro. ora'; -- dump the spfile file to ASM.

SQL> shutdown immediate;

[Aix203 oracle:/oracle] vi/u01/app/oracle/product/10.2.0/db_1/dbs/initmetro. ora

-- Modify the pfile under $ ORACLE_HOME and rename the spfile to start it using pfile.

SPFILE = '+ DATA/spfilemetro. ora'

SQL> startup mount; -- check that the spfile should be started for the spfile in ASM.

SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+ data'; -- modify the DATA file path to ASM.

SQL> ALTER SYSTEM SET CONTROL_FILES = 'data' SCOPE = SPFILE; -- modify the control file pointing to the path

SQL> startup nomount; -- restart the database to the nomount status.

RMAN> restore controlfile from '/u01/app/oracle/oradata/metro/control01.ctl ';

-- The information in the control file has been directed to ASM, and the control file is dumped to ASM using rman.

RMAN> mount database; -- start the database to the mount state.

RMAN> switch database to copy;

Releasedchannel: ORA_DISK_1

RMAN-00571: ========================================================== ==============================

RMAN-00569: ==================== error message stack follows ==========================

RMAN-00571: ========================================================== ==============================

RMAN-03002: failure of switch to copy command at 05/29/2014 18:49:14

RMAN-06571: datafile 1 does not have recoverable copy

-- Perform a cold backup again in the nomount status

RMAN> run {

2> allocate channel c1 device type disk;

3> allocate channel c2 device type disk;

4> backup as copy database format '+ data ';

5>}

RMAN> mount database;

RMAN> switch database to copy; -- execute again, and an error is still reported

Releasedchannel: ORA_DISK_1

RMAN-00571: ========================================================== ==============================

RMAN-00569: ==================== error message stack follows ==========================

RMAN-00571: ========================================================== ==============================

RMAN-03002: failure of switch to copy command at 05/29/2014 18:58:14

RMAN-06571: datafile 1 does not have recoverable copy

-- Try to back up datafile1 separately, and the error is still reported

-- Try to dump the control file again and back up again. The error still persists.

-- Try re-creating disk arrays, re-creating volume groups, logical volumes, and disk groups, dumping parameter files, control files, and re-backup. The error still persists.

-- Re-create the disk array, re-plan the fault tolerance policy, re-dump parameter files, control files, and re-Backup.

-- Manually direct the data file to the corresponding ASM.

SQL> alter database rename file '+ DATA/metro/datafile/system.257.848858337' to '+ DATA/METRO/DATAFILE/SYSTEM.264.848860609'; -- points to the system tablespace file

SQL> alter database rename file '/u01/app/oracle/oradata/metro/undotbs01.dbf' to '+ DATA/METRO/DATAFILE/UNDOTBS1.266.848860809'; -- point to the undo tablespace file

SQL> alter database rename file '/u01/app/oracle/oradata/metro/sysaux01.dbf' to '+ DATA/METRO/DATAFILE/SYSAUX.263.848860607'; -- pointing to the sysaux tablespace file

SQL> alter database rename file '/u01/app/oracle/oradata/metro/users01.dbf' to' + DATA/METRO/DATAFILE/USERS.267.848860815 '; -- point to users tablespace file

SQL> alter database rename file '/u01/app/oracle/oradata/metro/example01.dbf' to '+ DATA/METRO/DATAFILE/EXAMPLE.265.848860723'; -- pointing to the example tablespace file

SQL> alter database open;

-- When the database is started, because the dumped data file is a unified SCN, but it is inconsistent with the log SCN at this time, Incomplete recovery is required.

Alter databaseopen

*

ERROR at line 1:

ORA-01190: control file or data file 1 is from before the last RESETLOGS

ORA-01110: data file 1: '+ DATA/metro/datafile/system.264.848860609'

SQL> alter database open resetlogs; -- prompts Incomplete recovery.

Alter databaseopen resetlogs

*

ERROR at line 1:

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

SQL> recover database until cancel; -- make an incomplete recovery

ORA-00279: change 862849 generated at 05/29/2014 18:22:44 needed for thread 1

ORA-00289: suggestion:/u01/app/oracle/arch1/10915_837941495.dbf

ORA-00280: change 862849 for thread 1 is in sequence #15

Specify log :{ = Suggested | filename | AUTO | CANCEL}

Auto -- automatically search for the required log sequence.

ORA-00279: change 863386 generated at 05/29/2014 19:40:54 needed for thread 1

ORA-00289: suggestion:/u01/app/oracle/arch1/g01_848864454.dbf

ORA-00280: change 863386 for thread 1 is in sequence #1

ORA-00278: logfile '/u01/app/oracle/arch1/41515_842541495.dbf' no longer needed

For thisrecovery

ORA-00308: cannot open archived log '/u01/app/oracle/arch1/g01_848864454.dbf'

ORA-27037: unable to obtain file status

Ibm aix RISCSystem/6000 Error: 2: No such file or directory

Additionalinformation: 3

SQL> recover database until cancel;

-- The re-execution is not completely restored. The log sequence # is 1.

ORA-00279: change 863386 generated at 05/29/2014 19:06:03 needed forthread 1

ORA-00289: suggestion:/u01/app/oracle/arch1/g01_848864454.dbf

ORA-00280: change 863386 for thread 1 is in sequence #1

Specify log :{ = Suggested | filename | AUTO | CANCEL}

SQL> set linesize 300

SQL> select * from v $ log; -- Query That the log group whose sequence # is 1 is a 2nd log Group

GROUP # THREAD # SEQUENCE # bytes members arc status FIRST_CHANGE # FIRST_TIM

-------------------------------------------------------------------------------------------

1 1 0 52428800 2 YESUNUSED 0

3 1 0 52428800 2 yes unused 0

2 1 1 52428800 2 no current 86338629-MAY-14

SQL> select * from v $ logfile; -- find the log members in the 2nd log group.

GROUP # status type member is _

-----------------------------------------------------------------------------------------------

3 ONLINE/u01/app/oracle/oradata/metro/redo03.log NO

2 ONLINE/u01/app/oracle/oradata/metro/redo02.log NO

1 ONLINE/u01/app/oracle/oradata/metro/redo01.log NO

1 ONLINE/disk1/metro/redofile/redo01a. log NO

2 ONLINE/disk1/metro/redofile/redo02a. log NO

3 ONLINE/disk1/metro/redofile/redo03a. log NO

-- Enter the members of the log group whose sequence # is 1, that is, redo02.log.

Specify log :{ = Suggested | filename | AUTO | CANCEL}

/U01/app/oracle/oradata/metro/redo02.log

Log applied.

Media recovery complete.

SQL> select status fromv $ instance;

STATUS

------------

MOUNTED

SQL> alter database open;

Alter database open

*

ERROR at line 1:

The ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

SQL> select status fromv $ instance;

STATUS

------------

OPEN

SQL> select NAME from v $ datafile;

NAME

----------------------------------------------------------------------------

+ DATA/METRO/DATAFILE/SYSTEM.264.848860609

+ DATA/METRO/DATAFILE/UNDOTBS1.266.848860809

+ DATA/METRO/DATAFILE/SYSAUX.263.848860607

+ DATA/METRO/DATAFILE/USERS.267.848860815

+ DATA/METRO/DATAFILE/EXAMPLE.265.848860723

-- Now, the data file is dumped to ASM

**************************************** **************************************** *********

Post-goal: migrate temporary tablespace and log files to ASM

**************************************** **************************************** *********

SQL> select NAME fromv $ tempfile; -- view the temporary tablespace location

NAME

--------------------------------------------------------------------------------

/U01/app/oracle/oradata/metro/temp01.dbf

SQL> selectname, status, enabled from v $ tempfile; -- view the temporary tablespace status

NAME STATUS ENABLED

-------------------------------------------------------------

/U01/app/oracle/oradata/metro/temp01.dbf ONLINE READ WRITE

SQL> alter tablespace tempadd tempfile '+ data'; -- add a temporary ASM tablespace.

SQL> alter tablespace temp drop tempfile '/u01/app/oracle/oradata/metro/temp01.dbf'; -- delete the original temporary tablespace

-- Next we will migrate the log file

SQL> set linesize 120

SQL> select * from v $ log; -- view the status of the current log Group

GROUP # THREAD # SEQUENCE # bytes members arc status FIRST_CHANGE # FIRST_TIM

-------------------------------------------------------------------------------------------

1 1 0 52428800 2 YESUNUSED 0

2 1 1 52428800 2 no current 863885 29-MAY-14

3 1 0 52428800 2 yes unused 0

-- Add three groups of logs

SQL> alter database addlogfile '+ data' SIZE 50 m;

SQL> alter database addlogfile '+ data' SIZE 50 m;

SQL> alter database addlogfile '+ data' SIZE 50 m;

SQL> selectl. group #, l. sequence #, f. member as name, l. status, l. archived from v $ logl, v $ logfile f

2 where f. group # = l. group #

3 order by 1; -- view the log usage status for the current day

GROUP # SEQUENCE # NAME STATUS ARC

-------------------------------------------------------------------------------

1 0/disk1/metro/redofile/redo01a. log UNUSED YES

1 0/u01/app/oracle/oradata/metro/redo01.log UNUSED YES

2 1/disk1/metro/redofile/redo02a. log CURRENT NO

2 1/u01/app/oracle/oradata/metro/redo02.log CURRENT NO

3 0/disk1/metro/redofile/redo03a. log UNUSED YES

3 0/u01/app/oracle/oradata/metro/redo03.log UNUSED YES

4 0 + DATA/metro/onlinelog/group_4.274.848866UNUSED YES

125

5 0 + DATA/metro/onlinelog/group_5.275.848866 UNUSED YES

171

6 0 + DATA/metro/onlinelog/group_6.276.848866 UNUSED YES

215

Archive multiple times, switch to the current log group, and use the 'alterdatabase drop logfile' command to delete the original log group. Retain the newly created ASM log group to migrate the log file to ASM.

SQL> selectl. group #, l. sequence #, f. member as name, l. status, l. archived from v $ logl, v $ logfile f

2 where f. group # = l. group #

3 order by 1;

GROUP # SEQUENCE # NAME STATUS ARC

-------------------------------------------------------------------------------

1 2/disk1/metro/redofile/redo01a. log INACTIVE YES

1 2/u01/app/oracle/oradata/metro/redo01.log INACTIVE YES

2 7/disk1/metro/redofile/redo02a. log CURRENT NO

2 7/u01/app/oracle/oradata/metro/redo02.log CURRENT NO

3 3/disk1/metro/redofile/redo03a. log INACTIVE YES

3 3/u01/app/oracle/oradata/metro/redo03.logINACTIVE YES

4 4 + DATA/metro/onlinelog/group_4.274.848866 INACTIVE YES

125

5 5 + DATA/metro/onlinelog/group_5.275.848866 INACTIVE YES

171

6 6 + DATA/metro/onlinelog/group_6.276.848866 INACTIVE YES

215

Example:

Run the following command to delete the original log group:

SQL> alter database drop logfile group 1;

Follow-up:

An error is reported when the switch command is executed. It is found that the details are incorrect. That is, the information in the control file is updated only when the data file is dumped to ASM, the previous attempts were all backed up under nomount, dumping the file to the ASM. Retry the experiment and dump it under mount. If no error is reported, the problem is solved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.