Get the App
SLTechnology News&Howtos  ›  Database  › 

How to rename kgroup in ASM

Shulou Source: shulou.com Published: 2022-05-31 19:12:37 09月15日 Update

This article is to share with you about how to rename kgroup in ASM. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

ASM Management-how to rename diskgroup

A new feature of diskgroup renaming has been added in ASM 11.2.0.1. Rename the created diskgroup through the renamedg command. Dismount diskgroup is required before renaming.

If the renamed diskgroup is already used to store the database's data files, you need to manually synchronize the location of the data files.

-- check that ASM diskgroup's current name is DGASMDB

$su-grid

$sqlplus / as sysasm

SQL > select GROUP_NUMBER,name,state,type, offline_disks, ALLOCATION_UNIT_SIZE,BLOCK_SIZE,TOTAL_MB,FREE_MB from v$asm_diskgroup

GROUP_NUMBER NAME STATE TYPE OFFLINE_DISKS ALLOCATION_UNIT_SIZE BLOCK_SIZE TOTAL_MB FREE_MB

1 DGASMDB MOUNTED EXTERN 0 1048576 4096 3992 1879

-- check the current database information (spfile/controlfile/datafile/redo)

Su-oracle

$sqlplus / as sysdba

SQL > show parameter spfile

NAME TYPE VALUE

-

Spfile string + DGASMDB/asmdb/spfileasmdb.ora

SQL > show parameter control

NAME TYPE VALUE

-

Control_files string + DGASMDB/asmdb/controlfile/current.256.856653049

SQL > select name from v$datafile

NAME

+ DGASMDB/asmdb/datafile/system.260.856653053

+ DGASMDB/asmdb/datafile/sysaux.261.856653059

+ DGASMDB/asmdb/datafile/undotbs1.262.856653061

+ DGASMDB/asmdb/datafile/users.264.856653075

+ DGASMDB/asmdb/datafile/asm_test.dbf

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

-- dismount diskgroup dgasmdb

$su-grid

$asmcmd umount dgasmdb

-- repeat the command diskgroup, and the new diskgroup is called dgasmdb_new

$renamedg phase=both dgname=dgasmdb newdgname=dgasmdb_new verbose=true

Parsing parameters..

Parameters in effect:

Old DG name: DGASMDB

New DG name: DGASMDB_NEW

Phases:

Phase 1

Phase 2

Discovery str: (null)

Clean: TRUE

Raw only: TRUE

Renamedg operation: phase=both dgname=dgasmdb newdgname=dgasmdb_new verbose=true

Executing phase 1

Discovering the group

Performing discovery with string:

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ASMDISK4G1 with disk number:0 and timestamp (33006423 142494720)

Checking for hearbeat...

Re-discovering the group

Performing discovery with string:

Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:ASMDISK4G1 with disk number:0 and timestamp (33006423 142494720)

Checking if the diskgroup is mounted or used by CSS

Checking disk number:0

Generating configuration file..

Completed phase 1

Executing phase 2

Looking for ORCL:ASMDISK4G1

Modifying the header

Completed phase 2

Terminating kgfd context 0x7fa6c2bee0a0

Mount's new diksgroup dgasmdb_new

$asmcmd mount dgasmdb_new

-- View new diskgroup information

SQL > select GROUP_NUMBER,name,state,type, offline_disks, ALLOCATION_UNIT_SIZE,BLOCK_SIZE,TOTAL_MB,FREE_MB from v$asm_diskgroup

GROUP_NUMBER NAME STATE TYPE OFFLINE_DISKS ALLOCATION_UNIT_SIZE BLOCK_SIZE TOTAL_MB FREE_MB

1 DGASMDB_NEW MOUNTED EXTERN 0 1048576 4096 3992 1879

-- modify DB initialization parameter (/ u01/app/oracle/product/11.2.0/dbhome_1/dbs/initasmdb.ora) configuration information

Original: SPFILE='+DGASMDB/asmdb/spfileasmdb.ora'

Modified: SPFILE='+DGASMDB_NEW/asmdb/spfileasmdb.ora'

-- start database nomount

Su-oracle

Sqlplus / as sysdba

Startup nomount

-- modify control_files parameters:

SQL > alter system set control_files='+DGASMDB_NEW/asmdb/controlfile/current.256.856653049' scope=spfile

SQL > shutdown immediate

SQL > startup mount

SQL > show parameter control_files

NAME TYPE VALUE

-

Control_files string + DGASMDB_NEW/asmdb/controlfile

/ current.256.856653049

-- confirm that the datafile of the current record is still in the original diskgroup DGASMDB

SQL > select FILE#,name from v$datafile

FILE# NAME

--

1 + DGASMDB/asmdb/datafile/system.260.856653053

2 + DGASMDB/asmdb/datafile/sysaux.261.856653059

3 + DGASMDB/asmdb/datafile/undotbs1.262.856653061

4 + DGASMDB/asmdb/datafile/users.264.856653075

5 + DGASMDB/asmdb/datafile/asm_test.dbf

SQL > select file#, name from v$tempfile

FILE# NAME

-

1 + DGASMDB/asmdb/tempfile/temp.263.856653061

-- modify the datafile/tempfile location:

SQL > conn / as sysdba

SQL > ALTER DATABASE RENAME FILE'+ DGASMDB/asmdb/datafile/system.260.856653053' TO'+ DGASMDB_NEW/asmdb/datafile/system.260.856653053'

SQL > ALTER DATABASE RENAME FILE'+ DGASMDB/asmdb/datafile/sysaux.261.856653059' TO'+ DGASMDB_NEW/asmdb/datafile/sysaux.261.856653059'

SQL > ALTER DATABASE RENAME FILE'+ DGASMDB/asmdb/datafile/undotbs1.262.856653061' TO'+ DGASMDB_NEW/asmdb/datafile/undotbs1.262.856653061'

SQL > ALTER DATABASE RENAME FILE'+ DGASMDB/asmdb/datafile/users.264.856653075' TO'+ DGASMDB_NEW/asmdb/datafile/users.264.856653075'

SQL > ALTER DATABASE RENAME FILE'+ DGASMDB/asmdb/datafile/asm_test.dbf' TO'+ DGASMDB_NEW/asmdb/datafile/asm_test.dbf'

SQL > ALTER DATABASE RENAME FILE'+ DGASMDB/asmdb/tempfile/temp.263.856653061' TO'+ DGASMDB_NEW/asmdb/tempfile/temp.263.856653061'

-- confirm after modification:

SQL > select FILE#,name from v$datafile

FILE# NAME

--

1 + DGASMDB_NEW/asmdb/datafile/system.260.856653053

2 + DGASMDB_NEW/asmdb/datafile/sysaux.261.856653059

3 + DGASMDB_NEW/asmdb/datafile/undotbs1.262.856653061

4 + DGASMDB_NEW/asmdb/datafile/users.264.856653075

5 + DGASMDB_NEW/asmdb/datafile/asm_test.dbf

-- modify the redo log location

Alter database rename file'+ DGASMDB/asmdb/onlinelog/group_1.257.856653049' to'+ DGASMDB_NEW/asmdb/onlinelog/group_1.257.856653049'

Alter database rename file'+ DGASMDB/asmdb/onlinelog/group_2.258.856653051' to'+ DGASMDB_NEW/asmdb/onlinelog/group_2.258.856653051'

Alter database rename file'+ DGASMDB/asmdb/onlinelog/group_3.259.856653051' to'+ DGASMDB_NEW/asmdb/onlinelog/group_3.259.856653051'

Select * from v$logfile

-- start the database

SQL > alter database open

The above is how to rename kgroup in ASM. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Data database location information parameters commands files more knowledge articles checks utility names that is work sessions manual articles new features versions see Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Redmi MySQL Xiaomi