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://www.blogger.com/blog/post/edit/4187204636885547533/7930803541089488075
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
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.
Website không chứa bất kỳ quảng cáo nào, mọi đóng góp để duy trì phát triển cho website (donation) xin vui lòng gửi về STK 90.2142.8888 - Ngân hàng Vietcombank Thăng Long - TRAN VAN BINH
=============================
Nếu bạn không muốn bị AI thay thế và tiết kiệm 3-5 NĂM trên con đường trở thành DBA chuyên nghiệp hay làm chủ Database thì hãy đăng ký ngay KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE, được Coaching trực tiếp từ tôi với toàn bộ bí kíp thực chiến, thủ tục, quy trình của gần 20 năm kinh nghiệm (mà bạn sẽ KHÔNG THỂ tìm kiếm trên Internet/Google) từ đó giúp bạn dễ dàng quản trị mọi hệ thống Core tại Việt Nam và trên thế giới, đỗ OCP.
- CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
- Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
2 khóa học online qua video giúp bạn nhanh chóng có những kiến thức nền tảng về Linux, Oracle, học mọi nơi, chỉ cần có Internet/4G:
- Oracle cơ bản: https://bit.ly/admin_1200
- Linux: https://bit.ly/linux_1200
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile/Zalo: 0902912888
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: https://www.youtube.com/@binhguru
👨 Tiktok: https://www.tiktok.com/@binhguru
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhguru
👨 Podcast: https://www.podbean.com/pu/pbblog-eskre-5f82d6
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội
=============================
cở sở dữ liệu, cơ sở dữ liệu quốc gia, database, AI, trí tuệ nhân tạo, artificial intelligence, machine learning, deep learning, LLM, ChatGPT, DeepSeek, Grok, oracle tutorial, học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle ở đầu, Khóa học Oracle online,sql tutorial, khóa học pl/sql tutorial, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c/21c/23c/23ai, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail,oracle RAC, ASM, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle oca, oracle ocp, oracle ocm , oracle weblogic, postgresql tutorial, mysql tutorial, mariadb tutorial, ms sql server tutorial, nosql, mongodb tutorial, oci, cloud, middleware tutorial, docker, k8s, micro service, hoc solaris tutorial, hoc linux tutorial, hoc aix tutorial, unix tutorial, securecrt, xshell, mobaxterm, putty
Sửa bài viết