In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What are the commonly used db2 commands? for this question, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
One: start the command
1.1 Open a command line window
# db2cmd
1.2 Open the Control Center
# db2cmddb2cc
1.3 Open the Command Editor
Db2cmddb2ce
Two: operating the database command
2.1 start the database instance
# db2start
2.2 stop the database instance
# db2stop
2.3 create a database
# db2createdb [dbname]
2.4 Connect to the database
# db2connectto[dbname] user[username] using[password]
2.5 disconnect the database
# db2connectreset
2.6 list all databases
# db2listdbdirectory
2.7 list all active databases
# db2listactivedatabases
2.8 list all database configurations
# db2getdbcfg
2.9 Delete the database
# db2dropdatabase [dbname]
Three: operate the datasheet command
3.1 list all user tables
# db2listtables
3.2 list all system tables
# db2listtablesforsystem
3.3 list all tables
# db2listtablesforall
3.4 list system tables
# db2listtablesforsystem
3.5 list the user table
# db2listtablesforuser
3.6 list specific user tables
# db2listtablesforschema [user]
3.7 query table
# db2 "select*fromtablenamewhere..."
3.8 display table structure
# db2describetabletablename
3.9 modify column
# db2altertable [tablename] altered column [columname] setdatatypevarchar (24)
Four: script file operation command
4.1 execute script file
# db2-tvfscripts.sql
4.2 help command
* View command help
# db2?db2start
* View error code information
# db2?22001
4.3 back up the database
# db2backupdb
Note: you need to disconnect the database before executing the above command
4.4 online backup of database
# db2- v "BACKUPDATABASEONLINETOWITH2BUFFERSBUFFER1024INCLUDELOGSWITHOUTPROMPTING"
4.5 restore the database
# db2restoredb
4.6 online recovery of database
# db2 "RESTOREDBTOLOGTARGETWITHOUTPROMPTING"
# db2 "ROLLFORWARDDBTOENDOFLOGSANDSTOP"...
4.7 Export data file
# db2moveexport
[- sn]
[- tn]
4.8 Import data file
# db2moveimport
The answers to the questions about the commonly used db2 commands are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.