昨晚做数据库迁移测试,用的是备份恢复的方法,在RESTORE时报SQL1205N错误。DB2版本为8.2,在信息中心中查询,结果如下:
SQL1205N
The code page code-page and/or territory code territory that has been specified is not valid.
Explanation:
This version of DB2 does not support the active code page or territory code or both, as specified by the Create Database command.
The command cannot be processed.
User Response:
Refer to the Create Database command in the Command Reference for details of valid code page and territory code pairs supported by DB2/2.
二、提取备份镜像中的日志文件
使用backup database命令的include logs参数,可以将恢复所需的日志文件包含在备份镜像内。在恢复时,需要使用restore database命令的logs参数和logtarget参数提取日志文件。这两个参数的作用如下:
logs:指定仅还原备份镜像中的日志文件。指定该选项,则必须指定logtarget选项。
logtarget:指定释放日志文件的目标目录。
下面的示例中先RESTORE恢复数据库,再将日志文件从备份镜像中还原出来。其实,两个操作可以同时完成,将两条命令合并为“db2 restore db ggyy from /data/backup taken at 20091110145515 to /data/dbdir logtarget /data/palog/db2inst1/GGYY/NODE0000/C0000003”即可,注意没有logs参数。
db2inst1@suse-db:/data/palog/db2inst1/GGYY/NODE0000/C0000003> db2 restore db ggyy from /data/backup taken at 20091110145515 to /data/dbdir
DB20000I The RESTORE DATABASE command completed successfully.
db2inst1@suse-db:/data/palog/db2inst1/GGYY/NODE0000/C0000003> db2 restore db ggyy logs from /data/backup taken at 20091110145515 logtarget /data/palog/db2inst1/GGYY/NODE0000/C0000003
SQL2580W Warning! Restoring logs to a path which contains existing log files.
Attempting to overwrite an existing log file during restore will cause the
restore operation to fail.
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
db2inst1@suse-db:/data/palog/db2inst1/GGYY/NODE0000/C0000003> db2 rollforward db ggyy to end of logs
Rollforward Status
Input database alias = ggyy
Number of nodes have returned status = 1
Node number = 0
Rollforward status = DB working
Next log file to be read = S0000022.LOG
Log files processed = S0000022.LOG - S0000022.LOG
Last committed transaction = 2009-11-10-06.55.30.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
db2inst1@suse-db:/data/palog/db2inst1/GGYY/NODE0000/C0000003> db2 rollforward db ggyy to end of logs and stop
Rollforward Status
Input database alias = ggyy
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0000022.LOG - S0000022.LOG
Last committed transaction = 2009-11-10-06.55.30.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
db2inst1@suse-db:/data/dbdir/db2inst1/NODE0000/SQL00001/SQLOGDIR> db2 connect to ggyy
Database Connection Information
Database server = DB2/LINUX 9.7.0
SQL authorization ID = DB2INST1
Local database alias = GGYY
db2inst1@suse-db:/data/dbdir/db2inst1/NODE0000/SQL00001/SQLOGDIR> db2 list tablespaces
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 1
Name = TEMPSPACE1
Type = System managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 3
Name = SYSTOOLSPACE
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 4
Name = SYSTOOLSTMPSPACE
Type = System managed space
Contents = User Temporary data
State = 0x0000
Detailed explanation:
Normal
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11662464/viewspace-1028764/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11662464/viewspace-1028764/