In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to change the db2 archiving and backup recovery, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.
Check the database settings in DB2, if you find the following information
$db2 get db cfg for db_name | grep-I log
The results are as follows:
Log retain for recovery enabled (LOGRETAIN) = OFF
User exit for logging enabled (USEREXIT) = OFF
HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC
First log archive method (LOGARCHMETH1) = OFF
Then it is in non-archive mode and circular log by default
2. Set up the filing of DB2
Open archiving
Db2 update db cfg for database name using userexit on
Db2 update db cfg for database name using LOGRETAIN ON
Set the archive log path
Db2 update db cfg for database name using LOGARCHMETH1 "disk:/home/db2inst1/archive/ database name _ dblog"
Then stop the database and open the database for cold backup
$db2 backup db database name to / home/db2inst1/backup
III. Recovery
Transfer backups and logs to other servers, pay attention to ownership and permissions
And then start to restore.
Db2 restore db database name from / backup taken at 20140212190154 to / backup/log17
DB20000I The RESTORE DATABASE command completed successfully.
You can't connect to the database, and you need to roll forward the log.
$db2 connect to database name
SQL1117N A connection to or activation of database "database name" cannot be made
Because of ROLL-FORWARD PENDING. SQLSTATE=57019
Db2inst1@sqdb01:~ > db2 rollforward db database name to end of logs and complete
Rollforward Status
Input database alias = database name
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed =-
Last committed transaction = 2014-02-12-11.01.58.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
Db2inst1@sqdb01:~ > db2 connect to mblog
Database Connection Information
Database server = DB2/LINUXX8664 9.7.6
SQL authorization ID = DB2INST1
Local database alias = MBLOG
Or there's another way.
Switch to db2inst1 user
Delete the original library if it is available
Enter the directory where the backup is located
Execute the following statement
Db2 restore db mblog without rolling forward
(will revert to / home/db2inst1)
After recovery, check whether the library can be connected, check the database directory and archive directory, and if the space is limited, modify it and put it in a directory with large space.
Thank you for reading this article carefully. I hope the article "how to change db2 Archiving and backup recovery" shared by the editor will be helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.