Quản trị Controlfile trong Oracle database RAC 19c

Trong bài viết này chúng ta cùng đi demo việc quản trị Controlfile trong Oracle RAC:

Controlfile là gì: https://datalinks.vn/control-files-la-gi/

Kiểm tra thông tin Controlfile:

select name from v$controlfile;

show parameter control_files

SQL> select name from v$controlfile;

NAME

——————————————————————————–

+DATA/DUONG/CONTROLFILE/current.274.1168734577

+FRA/DUONG/CONTROLFILE/current.275.1168734579

SQL> show parameter control_files

NAME TYPE VALUE

———————————— ———– ——————————

control_files string +DATA/DUONG/CONTROLFILE/curren

t.274.1168734577, +FRA/DUONG/C

ONTROLFILE/current.275.1168734

579

=> Như vậy là hiện tại chúng ta có 2 controlfile trong +DATA, +FRA

Quản trị 1: Cấu hình bỏ 1 controlfile trong +FRA, chỉ để lại +DATA thôi

Tăt Database RAC và nomount lại:

exit

srvctl stop database -d duong

srvctl status database -d duong

srvctl start database -d duong -o nomount

sqlplus / as sysdba

alter system set control_files='+DATA/DUONG/CONTROLFILE/current.274.1168734577' scope=spfile sid='*';

sid=’*’: tức là áp dụng cho tất cả instance của RAC database

exit

srvctl stop database -d duong

srvctl start database -d duong

sqlplus / as sysdba

select name from v$controlfile;

show parameter control_files

SQL> show parameter control_files

NAME TYPE VALUE

———————————— ———– ——————————

control_files string +DATA/DUONG/CONTROLFILE/curren

t.274.1168734577, /u01/app/ora

cle/product/19c/dbhome_1/dbs/

+FRA/DUONG/CONTROLFILE/current

.275.1168734579

SQL> alter system set control_files=’+DATA/DUONG/CONTROLFILE/current.274.1168734577′ scope=spfile sid=’*’;

System altered.

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production

Version 19.3.0.0.0

[oracle@rac1 ~]$ srvctl stop database -d duong

[oracle@rac1 ~]$ srvctl start database -d duong -o nomount

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 – Production on Sun May 12 15:26:21 2024

Version 19.3.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production

Version 19.3.0.0.0

SQL> select name from v$controlfile;

no rows selected

SQL> show parameter control_files

NAME TYPE VALUE

———————————— ———– ——————————

control_files string +DATA/DUONG/CONTROLFILE/curren

t.274.1168734577

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production

Version 19.3.0.0.0

[oracle@rac1 ~]$ srvctl stop database -d duong

[oracle@rac1 ~]$ srvctl start database -d duong

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 – Production on Sun May 12 15:29:57 2024

Version 19.3.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production

Version 19.3.0.0.0

SQL> select name, open_mode from v$database;

NAME OPEN_MODE

——— ——————–

DUONG READ WRITE

SQL> show parameter control_

NAME TYPE VALUE

———————————— ———– ——————————

control_file_record_keep_time integer 7

control_files string +DATA/DUONG/CONTROLFILE/curren

t.274.1168734577

control_management_pack_access string DIAGNOSTIC+TUNING

SQL> select name from v$controlfile;

NAME

——————————————————————————–

+DATA/DUONG/CONTROLFILE/current.274.1168734577

=>Check bên RAC2 cũng đã cập nhật thông tin từ RAC1

Quản trị 2: Xoá controlfile trong +FRA sau đó tạo lại từ +DATA

asmcmd

ls +FRA/DUONG/controlfile

cd +FRA/DUONG/controlfile

rm Current.275.1168734579

ls +FRA/DUONG/controlfile

=> Ko còn controlfile trong +FRA nữa

ASMCMD> ls +FRA/DUONG/controlfile

Current.275.1168734579

ASMCMD> cp Current.275.1168734579 controlfile1

copying +FRA/DUONG/controlfile/Current.275.1168734579 -> +FRA/DUONG/controlfile/controlfile1

ASMCMD> ls

## Tắt database và nomount lại, thêm +FRA vào cấu hình controlfile parameter:

srvctl stop database -d duong

srvctl start database -d duong -o nomount

sqlplus / as sysdba

alter system set control_files='+DATA/DUONG/CONTROLFILE/current.274.1168734577','+FRA' scope=spfile sid='*';
exit

srvctl stop database -d duong

srvctl start database -d duong -o nomount

rman target /

restore controlfile from '+DATA/DUONG/CONTROLFILE/current.274.1168734577';

exit

srvctl stop database -d duong

srvctl start database -d duong

SQL> alter system set control_files=’+DATA/DUONG/CONTROLFILE/current.274.1168734577′,’+FRA’ scope=spfile sid=’*’;

System altered.

SQL> srvctl stop database -d duong

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production

Version 19.3.0.0.0

[oracle@rac1 ~]$ srvctl stop database -d duong

[oracle@rac1 ~]$ srvctl start database -d duong -o nomount

[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 – Production on Sun May 12 16:03:00 2024

Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

connected to target database: DUONG (not mounted)

RMAN> restore controlfile from ‘+DATA/DUONG/CONTROLFILE/current.274.1168734577’;

Starting restore at 12-MAY-24

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=33 instance=duong1 device type=DISK

channel ORA_DISK_1: copied control file copy

output file name=+DATA/DUONG/CONTROLFILE/current.274.1168734577

output file name=+FRA/DUONG/CONTROLFILE/current.310.1168790591

Finished restore at 12-MAY-24

RMAN> exit

Recovery Manager complete.

[oracle@rac1 ~]$ srvctl stop database -d duong

[oracle@rac1 ~]$ srvctl start database -d duong

Check sau khi thực hiện thành công:

sqlplus / as sysdba

select name from v$controlfile;

show parameter control_files

select name, open_mode from v$database;

exit

asmcmd

ls +FRA/DUONG/controlfile

word image 1654 1

Demo thành công, trong thư mục +FRA đã tạo ra controlfile mới.

Chúc các bạn thành công.

 

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
guest

0 Góp ý
Phản hồi nội tuyến
Xem tất cả bình luận