Chủ Nhật, 15 tháng 11, 2020

Bật, tắt DB trong Oracle Database

1. Check

SELECT database_status FROM v$instance;

2. Startup

STARTUP [FORCE] [RESTRICT] [PFILE=filename]
[EXCLUSIVE | PARALLEL | SHARED]
[OPEN [RECOVER][database]|MOUNT |NOMOUNT]

ALTER database { MOUNT | OPEN |OPEN READ ONLY | OPEN READ WRITTE}


Edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
DB11G:/u01/app/oracle/product/11.2.0.4/db_1:Y

ALTER SYSTEM disable restricted session;

OPEN DATABASE KHI DATAIFLE BỊ LỖI

Khi đang open database 1 datafile bị lỗi, mất ví dụ /filesystem01/datafile11.dbf bị mất
Thông tin khi gõ lệnh startup:
Database Mounted
ORA-01116: Error in opening database file 34
ORA-01110: Datafile 34 : '/filesystem01/datafile11.dbf'
ORA-27041: Unable to open file.

Dưới đây là workground để bật nhanh database, sqlplus as sysdba.
1. STARTUP NOMOUNT;
2. ALTER DATABASE MOUNT;
3. ALTER DATABASE DATAFILE '/filesystem01/datafile11.dbf' OFFLINE DROP;
4. ALTER DATABASE OPEN;
5. ALTER TABLESPACE TEST OFFLINE;
6.RESTORE DATAFILE 34;
7.RECOVER DATAFILE 34;
8.ALTER TABLESPACE TEST ONLINE;

3. Shutdown

SHUTDOWN [NORMAL | TRANSACTIONAL | IMMEDIATE | ABORT ]

4.Suspend, resume

ALTER system { SUSPEND | RESUME }

5. Automatically start Instance

/var/opt/oracle/oratab (OR /etc/oratab)
-- Automatically start Oracle 11g on solaris after server reboot (N), disable (Y) 
+ASM2:/oracle/grid:N            # line added by Agent
oraazdb:/oracle/db:N               # line added by Agent

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/OracleDBAVietNam 👨 Website: http://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 #OracleTutorial #OracleDBA #OracleDatabaseAdministration #học oracle database #oca #ocp #oce #ocm

ĐỌC NHIỀU

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