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

Các câu lệnh hay sử dụng trong IBM DB2


1. Help
su - db2inst2
db2
db2 ==> ? (mọi lệnh của db2)
Db2 ==> ? Get (chi tiết lệnh get)
2. Stop a database
$ db2stop
$ db2stop force

3. Start a database:
$ db2start

4. Update config set archive log path:
$ db2 update db configuration for  <db_name> using logarchmeth1 disk:/u01/db2/archivelog/

5. Update config set time to delete archivelog:
$ db2 update db configuration for  <db_name> using REC_HIS_RETENTN 3

6. List active database:
$ db2 list active databases

7. Get config:
$ db2 get db cfg for <db_name>

8. List all DB:
$ db2 list db directory

9. Deactivate a database:
$ db2 deactivate db <db_name>

10. Activate a database
$ db2 activate db <db_name>

11. Get database manager config:
$ db2 get dbm cfg

        -- Lấy alert log của DB2
        $ db2 get dbm cfg |grep DIAGPATH

12. Get profile variable 
$ db2set -all

13. Connect to a database:
$ db2 connect to  <db_name>

14. Execute a SQL command:
$ db2 "select count(*) from dsrdbm01"

15. Disconnect from a database:
$ db2 terminate

16. Access db2 command line:
$ Db2
Db2> connect to <schema_nam>;
Db2> select schemaname from syscat.schemata
Db2> LIST TABLES FOR SCHEMA <schema_name>;

17. List backup history
$  db2 list history backup all for  <db_name>

18. Get db size
CALL GET_DBSIZE_INFO(?, ?, ?, -1)

19. Create alias for existing database:
db2 catalog database DSRDBM01 as ldapdb2b 

20. List active applications:
db2 list applications for database <db_name>
db2 list applications for database  <db_name> show detail

21. List indexes of a table:
DESCRIBE INDEXES FOR TABLE  <db_name>.ldap_entry SHOW DETAIL

        22. Check tải
        $ db2top

        23. Kill app gây lock, app bị treo
        $db2 force application (app_id)

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