Thứ Sáu, 1 tháng 10, 2021

Script off autoextend toàn bộ các datafile trong 1 diskgroup

Mục đích: 

Diskgroup DATA2, DATA3, DATA4 còn free < 20GB, đầy 99-100% rồi do đó cần off autoextend toàn bộ các datafile trong 1 diskgroup

Thực hiện:

1. Check diskgroup sắp đầy:

select group_number,type, name, round(total_mb/1024,2) "Total_GB", round(usable_file_mb/1024) "Usable_file_GB"  
from v$asm_diskgroup 
where round(usable_file_mb/1024) < 20GB
order by "Usable_file_GB";

2. Script sinh câu lệnh SQL


select  * from v$datafile where name like '%DATA2%' or name like '%DATA3%' or name like '%DATA4%';

select 'alter database datafile ' || file# ||' autoextend off;' from v$datafile where name like '%DATA2%' or name like '%DATA3%' or name like '%DATA4%';



3. Lấy câu lệnh ở trên và chạy trong TOAD hoặc SQL Navigator hoặc duyệt cursor

alter database datafile 2 autoextend off;
alter database datafile 8 autoextend off;
alter database datafile 430 autoextend off;
alter database datafile 2159 autoextend off;
alter database datafile 3050 autoextend off;
alter database datafile 3946 autoextend off;
alter database datafile 3947 autoextend off;
alter database datafile 8081 autoextend off;
alter database datafile 8082 autoextend off;
alter database datafile 8083 autoextend off;
alter database datafile 8084 autoextend off;
alter database datafile 8085 autoextend off;
alter database datafile 8086 autoextend off;
alter database datafile 8087 autoextend off;
alter database datafile 13146 autoextend off;
alter database datafile 15295 autoextend off;
alter database datafile 15397 autoextend off;
alter database datafile 15398 autoextend off;
alter database datafile 15399 autoextend off;
alter database datafile 15400 autoextend off;
alter database datafile 15401 autoextend off;
alter database datafile 15402 autoextend off;
alter database datafile 15403 autoextend off;
alter database datafile 15404 autoextend off;
alter database datafile 15405 autoextend off;
alter database datafile 15406 autoextend off;
alter database datafile 15407 autoextend off;
alter database datafile 15408 autoextend off;
alter database datafile 15409 autoextend off;
alter database datafile 15410 autoextend off;
alter database datafile 15411 autoextend off;
alter database datafile 15412 autoextend off;
alter database datafile 15413 autoextend off;
alter database datafile 15414 autoextend off;
alter database datafile 15415 autoextend off;
alter database datafile 15416 autoextend off;
....

4. Theo dõi sau khi thực hiện

Theo dõi liên tục vùng này để tránh đầy ổ.

select group_number,type, name, round(total_mb/1024,2) "Total_GB", round(usable_file_mb/1024) "Usable_file_GB"  
from v$asm_diskgroup 
where round(usable_file_mb/1024) < 20GB
order by "Usable_file_GB";

5. Các bước tiếp theo

- Chuyển bớt datafile sang phân vùng diskgroup khác (ví dụ RECO, FRA,...) theo các hướng dẫn sau:

https://www.tranvanbinh.vn/2021/02/quy-trinh-chuyen-datafile-sang-phan.html


- Bổ sung thêm LUN vào diskgroup DATA2, DATA3, DATA4 theo hướng dẫn: https://www.tranvanbinh.vn/2020/07/quy-trinh-add-o-ia-moi-vao-diskgroup.html

Hy vọng hữu ích cho bạn.

=============================
* KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE trực tiếp từ tôi giúp bạn bước đầu trở thành những chuyên gia DBA, đủ kinh nghiệm đi thi chứng chỉ OA/OCP, đặc biệt là rất nhiều kinh nghiệm, bí kíp thực chiến trên các hệ thống Core tại VN chỉ sau 1 khoá học.
* 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
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile: 0902912888
⚡️ Skype: tranbinh48ca
👨 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: http://bit.ly/ytb_binhoraclemaster
👨 Tiktok: https://www.tiktok.com/@binhoraclemaster?lang=vi
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhoracle
👨 Đị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

=============================
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,khóa học pl/sql, 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, 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 dataguard, oracle goldengate, mview, oracle exadata, oracle weblogic, middleware, hoc solaris, hoc linux, hoc aix, unix, oracle oca, oracle ocp, oracle ocm

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master