Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify ASM disk redundancy

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to modify ASM disk redundancy, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Rummaged through the official documents:

Automatic Storage Management Administrator's Guide->

4 Administering Oracle ASM Disk Groups->

Using the CREATE DISKGROUP SQL Statement-> Specify the redundancy level of the disk group.

After a disk group is created, you cannot alter the redundancy level of the disk group. To change the redundancy level, you must create another disk group with the appropriate redundancy and then move the files to the new disk group.

After an ASM disk group is created, the redundancy level of the disk group cannot be modified. If you want to change the redundancy level of a disk group, you must create another disk group with the appropriate redundancy level, and then move the data to the new disk group.

Official documentation link: http://docs.oracle.com/cd/E11882_01/server.112/e18951/asmdiskgrps.htm#CHDBDAGI

# # #

So there is the following experiment:

Since the previous virtual machine environment is 10gASM (the next time it is tested with 11g, the steps should be about the same), and the database is stored on + DATA disk, and the redundancy set by + DATA disk is regular redundancy, so this lab will change from regular redundancy to external redundancy.

The change of external redundancy to regular redundancy is basically consistent with the procedure of this experiment.

# # #

Migration steps:

First create a new ASM disk group.

First migrate the control files to the disk group, then migrate the data files, log files, and so on.

# # #

Create a new disk group

10g use dbca,11g with asmca, or directly with instructions. Here I use dbca:

Check the disk group:

Click (here) to collapse or open

[root@oracle4 ~] # su-oracle

[oracle@oracle4 ~] $export ORACLE_SID=+ASM

[oracle@oracle4 ~] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0-Production on Wed Aug 19 01:17:26 2015

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 state,name,type from v$asm_diskgroup

STATE NAME TYPE

MOUNTED DATA NORMAL

MOUNTED RECOVER EXTERN

MOUNTED NEWDG EXTERN

-here, we created a new ASM disk group called NEWDG, which is externally redundant.

Migrate control files to a new disk group

Environment: old control files on + data disk group, new on + newdg disk group

Migration method: first add a control file to + newdg, and then delete the old control file on + data disk

The migration steps are as follows:

-1. Change the parameters of the control file from one path on the + DATA disk to two paths in the parameter file

SQL > alter system set control_files='+DATA/asmdb/controlfile/current.260.886430449','+newdg' scope=spfile

-2. After changing to two paths, an error will be reported because the second file does not exist.

-restart the database to nomount mode and restore the second control file from the first control file using rman

SQL > startup force nomount

ORACLE instance started.

Total System Global Area 608174080 bytes

Fixed Size 1220844 bytes

Variable Size 180358932 bytes

Database Buffers 423624704 bytes

Redo Buffers 2969600 bytes

[oracle@oracle4 dbs] $rman target /

Recovery Manager: Release 10.2.0.1.0-Production on Wed Aug 19 01:47:18 2015

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

Connected to target database: asmdb (not mounted)

RMAN > restore controlfile from'+ DATA/asmdb/controlfile/current.260.886430449'

Starting restore at 19-AUG-15

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: copied control file copy

Output filename=+DATA/asmdb/controlfile/current.260.886430449

Output filename=+NEWDG/asmdb/controlfile/backup.257.888112073

Finished restore at 19-AUG-15

-marked in red is the generated new control file

-at this point, start the database to nomount mode

-you will find that the parameters have been modified:

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

[oracle@oracle4 dbs] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0-Production on Wed Aug 19 01:48:48 2015

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 > show parameter control

NAME TYPE VALUE

-

Control_file_record_keep_time integer 7

Control_files string + DATA/asmdb/controlfile/curren

T.260.886430449, + NEWDG/asmdb/controlfile/backup.257.888112073

The new control file parameter changes to the location of the control file that was previously restored by rman, as follows:

+ DATA/asmdb/controlfile/current.260.886430449-this is old

+ NEWDG/asmdb/controlfile/backup.257.888112073-this is the new location to which we need to be migrated, we find that the control file has been migrated to the new location, and then we need to delete the old control file

-3. Delete the old control file, so remove it from the control file parameters:

SQL > alter system set control_files='+NEWDG/asmdb/controlfile/backup.257.888112073' scope=spfile

System altered.

SQL > startup force

ORACLE instance started.

Total System Global Area 608174080 bytes

Fixed Size 1220844 bytes

Variable Size 180358932 bytes

Database Buffers 423624704 bytes

Redo Buffers 2969600 bytes

Database mounted.

Database opened.

SQL > show parameter control

NAME TYPE VALUE

-

Control_file_record_keep_time integer 7

Control_files string + NEWDG/asmdb/controlfile/backup.257.888112073

At this point, the control file was successfully moved to the + NEWDG disk.

Migrate data files to a new disk group

Environment: old data files on + data disk group, new data on + newdg disk group

Migration method: first make a mirror copy of the data file on + newdg, and then do switch to tell the control file that our data file is on + newdg, not on + data disk.

The migration steps are as follows:

-1. Copy data file

[oracle@oracle4 dbs] $rman target /

Recovery Manager: Release 10.2.0.1.0-Production on Wed Aug 19 01:51:13 2015

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

Connected to target database: ASMDB (DBID=630629232)

RMAN > backup as copy database format'+ newdg'

Starting backup at 19-AUG-15

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=144 devtype=DISK

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00001 name=+DATA/asmdb/datafile/system.256.886430341

Output filename=+NEWDG/asmdb/datafile/system.258.888112285 tag=TAG20150819T015122 recid=6 stamp=888112417

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:17

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00003 name=+DATA/asmdb/datafile/sysaux.257.886430341

Output filename=+NEWDG/asmdb/datafile/sysaux.259.888112421 tag=TAG20150819T015122 recid=7 stamp=888112494

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:16

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00005 name=+DATA/asmdb/datafile/example.265.886430497

Output filename=+NEWDG/asmdb/datafile/example.260.888112497 tag=TAG20150819T015122 recid=8 stamp=888112539

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:47

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00002 name=+DATA/asmdb/datafile/undotbs1.258.886430341

Output filename=+NEWDG/asmdb/datafile/undotbs1.261.888112547 tag=TAG20150819T015122 recid=9 stamp=888112564

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00004 name=+DATA/asmdb/datafile/users.259.886430341

Output filename=+NEWDG/asmdb/datafile/users.262.888112571 tag=TAG20150819T015122 recid=10 stamp=888112572

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

Channel ORA_DISK_1: starting datafile copy

Input datafile fno=00006 name=+DATA/asmdb/datafile/tbs1.267.886604335

Output filename=+NEWDG/asmdb/datafile/tbs1.263.888112573 tag=TAG20150819T015122 recid=11 stamp=888112580

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

Channel ORA_DISK_1: starting datafile copy

Copying current control file

Output filename=+NEWDG/asmdb/controlfile/backup.264.888112589 tag=TAG20150819T015122 recid=12 stamp=888112601

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15

Channel ORA_DISK_1: starting full datafile backupset

Channel ORA_DISK_1: specifying datafile (s) in backupset

Including current SPFILE in backupset

Channel ORA_DISK_1: starting piece 1 at 19-AUG-15

Channel ORA_DISK_1: finished piece 1 at 19-AUG-15

Piece handle=+NEWDG/asmdb/backupset/2015_08_19/nnsnf0_tag20150819t015122_0.265.888112607 tag=TAG20150819T015122 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 19-AUG-15

RMAN > list copy of database

Key File S Completion Time Ckp SCN Ckp Time Name

6 1 A 19-AUG-15 559320 19-AUG-15 + NEWDG/asmdb/datafile/system.258.888112285

9 2 A 19-AUG-15 559375 19-AUG-15 + NEWDG/asmdb/datafile/undotbs1.261.888112547

7 3A 19-AUG-15 559349 19-AUG-15 + NEWDG/asmdb/datafile/sysaux.259.888112421

10 4 A 19-AUG-15 559383 19-AUG-15 + NEWDG/asmdb/datafile/users.262.888112571

8 5 A 19-AUG-15 559366 19-AUG-15 + NEWDG/asmdb/datafile/example.260.888112497

11 6 A 19-AUG-15 559385 19-AUG-15 + NEWDG/asmdb/datafile/tbs1.263.888112573

3 6 A 01-AUG-15 514730 01-AUG-15 / home/oracle/tbs1.bak

-copy completed

-2. The copy of the data file has been completed, and we copied it with the database open. Now we need to switch the database to a new file, which actually tells the control file that the data file has been moved to a new location. So this step is just to change the contents of the control file, which will be very fast, but you need to set the database to mount state.

RMAN > switch database to copy

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of switch to copy command at 08/19/2015 02:00:35

RMAN-06572: database is open and datafile 1 is not offline

-Note: you need to start the database to execute switch in mount state.

RMAN > shutdown immediate

Database closed

Database dismounted

Oracle instance shut down

RMAN > startup mount

Connected to target database (not started)

Oracle instance started

Database mounted

Total System Global Area 608174080 bytes

Fixed Size 1220844 bytes

Variable Size 180358932 bytes

Database Buffers 423624704 bytes

Redo Buffers 2969600 bytes

RMAN > switch database to copy

Datafile 1 switched to datafile copy "+ NEWDG/asmdb/datafile/system.258.888112285"

Datafile 2 switched to datafile copy "+ NEWDG/asmdb/datafile/undotbs1.261.888112547"

Datafile 3 switched to datafile copy "+ NEWDG/asmdb/datafile/sysaux.259.888112421"

Datafile 4 switched to datafile copy "+ NEWDG/asmdb/datafile/users.262.888112571"

Datafile 5 switched to datafile copy "+ NEWDG/asmdb/datafile/example.260.888112497"

Datafile 6 switched to datafile copy "+ NEWDG/asmdb/datafile/tbs1.263.888112573"

-switch succeeded. The database uses new data files.

RMAN > alter database open

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of alter db command at 08/19/2015 02:01:54

ORA-01113: file 1 needs media recovery

ORA-01110: datafile 1:'+ NEWDG/asmdb/datafile/system.258.888112285'

RMAN > recover database

Starting recover at 19-AUG-15

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=157 devtype=DISK

Starting media recovery

Media recovery complete, elapsed time: 00:00:02

Finished recover at 19-AUG-15

RMAN > alter database open

Database opened

Successfully restore and open the database.

Migrate log files, temporary files, parameter files, etc., to a new disk group

Control files and data files have been moved successfully. Log files, temporary files and parameter files need to be moved.

The migration steps are as follows:

1. Check whether the data file is normal, and modify the parameters to put the new file on + newdg in the future.

SQL > select name from v$datafile

NAME

+ NEWDG/asmdb/datafile/system.258.888112285

+ NEWDG/asmdb/datafile/undotbs1.261.888112547

+ NEWDG/asmdb/datafile/sysaux.259.888112421

+ NEWDG/asmdb/datafile/users.262.888112571

+ NEWDG/asmdb/datafile/example.260.888112497

+ NEWDG/asmdb/datafile/tbs1.263.888112573

6 rows selected.

-check whether the data file is normal

SQL > show parameter create

NAME TYPE VALUE

-

Create_bitmap_area_size integer 8388608

Create_stored_outlines string

Db_create_file_dest string + DATA

Db_create_online_log_dest_1 string

Db_create_online_log_dest_2 string

Db_create_online_log_dest_3 string

Db_create_online_log_dest_4 string

Db_create_online_log_dest_5 string

SQL > alter system set db_create_file_dest ='+ newdg'

-in the future, new files will be generated on the new disk group.

System altered.

-add temporary files

SQL > select name from v$tempfile

NAME

+ DATA/asmdb/tempfile/temp.264.886430485

SQL > create temporary tablespace temp01 tempfile size 20m

Tablespace created.

SQL > SQL > select name from v$tempfile

NAME

+ DATA/asmdb/tempfile/temp.264.886430485

+ NEWDG/asmdb/tempfile/temp01.266.888113011

SQL > drop tablespace temp including contents and datafiles

Drop tablespace temp including contents and datafiles

*

ERROR at line 1:

ORA-12906: cannot drop default temporary tablespace

SQL > alter database default temporary tablespace temp01

-the old temporary tablespace is the system default temporary tablespace and cannot be deleted. Delete the old one after modification.

Database altered.

SQL > drop tablespace temp including contents and datafiles

Tablespace dropped.

3. Log files: add new members to new disks and delete old ones

-check the status of the log group

SQL > select * from v$log

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS

-

FIRST_CHANGE# FIRST_TIM

--

1 1 5 52428800 1 NO CURRENT

559083 19-AUG-15

2 1 3 52428800 1 YES INACTIVE

507040 01-AUG-15

3 1 4 52428800 1 YES INACTIVE

537744 19-AUG-15

-there are three groups. Add new members to each group.

SQL > alter database add logfile member'+ newdg' to group 1

Database altered.

SQL > alter database add logfile member'+ newdg' to group 2

Database altered.

SQL > alter database add logfile member'+ newdg' to group 3

Database altered.

SQL > alter system switch logfile

System altered.

SQL > /

System altered.

SQL > /

System altered.

SQL > /

System altered.

-switch logs many times, at least one round

SQL > select member from v$logfile

MEMBER

+ DATA/asmdb/onlinelog/group_3.263.886430465

+ DATA/asmdb/onlinelog/group_2.262.886430459

+ DATA/asmdb/onlinelog/group_1.261.886430455

+ NEWDG/asmdb/onlinelog/group_1.267.888113109

+ NEWDG/asmdb/onlinelog/group_2.268.888113113

+ NEWDG/asmdb/onlinelog/group_3.269.888113115

6 rows selected.

-New member added successfully

SQL > alter database drop logfile member'+DATA/asmdb/onlinelog/group_3.263.886430465'

Database altered.

SQL > alter database drop logfile member'+DATA/asmdb/onlinelog/group_2.262.886430459'

Alter database drop logfile member'+DATA/asmdb/onlinelog/group_2.262.886430459'

*

ERROR at line 1:

ORA-01609: log 2 is the current log for thread 1-cannot drop members

ORA-00312: onlinelog 2 thread 1:'+ DATA/asmdb/onlinelog/group_2.262.886430459'

ORA-00312: online log 2 thread 1:

'+ NEWDG/asmdb/onlinelog/group_2.268.888113113'

-the one in use cannot be deleted. Delete the non-current first, and then delete the member after switching logs.

SQL > alter database drop logfile member'+DATA/asmdb/onlinelog/group_1.261.886430455'

Database altered.

SQL > alter system switch logfile

System altered.

SQL > alter database drop logfile member'+DATA/asmdb/onlinelog/group_2.262.886430459'

Database altered.

SQL > select member from v$logfile

MEMBER

+ NEWDG/asmdb/onlinelog/group_1.267.888113109

+ NEWDG/asmdb/onlinelog/group_2.268.888113113

+ NEWDG/asmdb/onlinelog/group_3.269.888113115

-successful addition of new members and deletion of old members

4. Parameter file:

Generate pfile,pfile using spfile to generate a new spfile, and finally point the pfile to the new spfile

-View parameter file

SQL > show parameter spfile

NAME TYPE VALUE

-

Spfile string + DATA/asmdb/spfileasmdb.ora

SQL > create pfile from spfile

Create pfile

File created.

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > create spfile='+newdg/asmdb/spfileasmdb.ora' from pfile

-use pfile to generate new spfile

File created.

SQL >!

[oracle@oracle4 dbs] $vi initasmdb.ora

Spfile='+newdg/asmdb/spfileasmdb.ora'

-pfile points to the new spfile

SQL > startup force

ORACLE instance started.

Total System Global Area 608174080 bytes

Fixed Size 1220844 bytes

Variable Size 180358932 bytes

Database Buffers 423624704 bytes

Redo Buffers 2969600 bytes

Database mounted.

Database opened.

SQL >

-the new parameter file was added successfully, and the old parameter file was deleted successfully

V. Inspection

-check

Show parameter spfile

Select name from v$controlfile

Select name from v$datafile

Select name from v$tempfile

Select member from v$logfile

Select filename from v$block_change_tracking

Select name from v$flashback_database_logfile

SQL > show parameter pfile

NAME TYPE VALUE

-

Spfile string + NEWDG/asmdb/spfileasmdb.ora

SQL > select name from v$controlfile

NAME

+ NEWDG/asmdb/controlfile/backup.257.888112073

SQL > select name from v$datafile

NAME

+ NEWDG/asmdb/datafile/system.258.888112285

+ NEWDG/asmdb/datafile/undotbs1.261.888112547

+ NEWDG/asmdb/datafile/sysaux.259.888112421

+ NEWDG/asmdb/datafile/users.262.888112571

+ NEWDG/asmdb/datafile/example.260.888112497

+ NEWDG/asmdb/datafile/tbs1.263.888112573

6 rows selected.

SQL > select name from v$tempfile

NAME

+ NEWDG/asmdb/tempfile/temp01.266.888113011

SQL > select member from v$logfile

MEMBER

+ NEWDG/asmdb/onlinelog/group_1.267.888113109

+ NEWDG/asmdb/onlinelog/group_2.268.888113113

+ NEWDG/asmdb/onlinelog/group_3.269.888113115

SQL > select name from v$flashback_database_logfile

No rows selected

SQL > select filename from v$block_change_tracking

The above is all the contents of the article "how to modify ASM disk redundancy". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 301

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report