DB2V8.2資料恢復到v9.5 ONAIX

lenx2000發表於2011-02-26
db2 => connect to bpfdb

   Database Connection Information

 Database server        = DB2/AIX64 9.5.7
 SQL authorization ID   = DB2INST1
 Local database alias   = BPFDB

db2 => select   *   from   sysibm.sysversions 

VERSIONNUMBER VERSION_TIMESTAMP          AUTHID                                                                                                                          
------------- -------------------------- -------------------
      9050700 2011-02-24-08.51.05.354359 DB2INST1                                                                                                                        

  1 record(s) selected.
bash-3.2$ db2set -all
[i] DB2_HASH_JOIN=Y
[i] DB2COMM=tcpip
[g] DB2FCMCOMM=TCPIP4
[g] DB2SYSTEM=test2
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1
bash-3.2$     db2   list   database   directory 

 System Database Directory

 Number of entries in the directory = 2

Database 1 entry:

 Database alias                       = BPFDB
 Database name                        = BPFDB
 Local database directory             = /db2/bpfdb
 Database release level               = c.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

Database 2 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Local database directory             = /home/db2inst1
 Database release level               = c.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =
bash-3.2$ db2 force applications all
DB20000I  The FORCE APPLICATION command completed successfully.
DB21024I  This command is asynchronous and may not be effective immediately.

bash-3.2$ db2 list tablespaces
SQL1024N  A database connection does not exist.  SQLSTATE=08003
bash-3.2$ db2 connect to bpfdb
db2 list tablespaces
SQL1119N  A connection to or activation of database "BPFDB" cannot be made 
because a previous restore is incomplete or still in progress.  SQLSTATE=57019
bash-3.2$ db2 restore database BPFDB from /db2/back/ taken at 20110221030637 to /db2/bpfdb with 3 buffers buffer 1024 replace existing redirect WITHOUT ROLLING FORWARD
SQL2523W  Warning!  Restoring to an existing database that is different from 
the database on the backup image, but have matching names. The target database 
will be overwritten by the backup version.  The Roll-forward recovery logs 
associated with the target database will be deleted.
SQL1277W  A redirected restore operation is being performed.  Table space 
configuration can now be viewed and table spaces that do not use automatic 
storage can have their containers reconfigured.
DB20000I  The RESTORE DATABASE command completed successfully.
bash-3.2$ db2 list tablespaces

           Tablespaces for Current Database

 Tablespace ID                        = 0
 Name                                 = SYSCATSPACE
 Type                                 = System managed space
 Contents                             = All permanent data. Regular table space.
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

 Tablespace ID                        = 1
 Name                                 = TEMPSPACE1
 Type                                 = System managed space
 Contents                             = System Temporary data
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

 Tablespace ID                        = 2
 Name                                 = USERSPACE1
 Type                                 = System managed space
 Contents                             = All permanent data. Regular table space.
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

 Tablespace ID                        = 3
 Name                                 = UTMTP32
 Type                                 = System managed space
 Contents                             = User Temporary data
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

 Tablespace ID                        = 4
 Name                                 = SYSTOOLSPACE
 Type                                 = System managed space
 Contents                             = All permanent data. Regular table space.
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

 Tablespace ID                        = 5
 Name                                 = QCTEMPTSbash-3.2$ pwd
/db2/bpfdb
bash-3.2$ mkdir 0
bash-3.2$ db2 "set tablespace containers for 0 using (path '/db2/bpfdb/0')"
DB20000I  The SET TABLESPACE CONTAINERS command completed successfully.
bash-3.2$ db2 "set tablespace containers for 1 using (path '/db2/bpfdb/1')"
SQL0299N  Container is already assigned to the table space.  SQLSTATE=42731
bash-3.2$ db2 "set tablespace containers for 2 using (path '/db2/bpfdb/2')"
db2 "set tablespace containers for 3 using (path '/db2/bpfdb/3')"
db2 "set tablespace containers for 4 using (path '/db2/bpfdb/4')"
db2 "set tablespace containers for 5 using (path '/db2/bpfdb/5')"
SQL0299N  Container is already assigned to the table space.  SQLSTATE=42731
bash-3.2$ db2 "set tablespace containers for 3 using (path '/db2/bpfdb/3')"
SQL0299N  Container is already assigned to the table space.  SQLSTATE=42731
bash-3.2$ db2 "set tablespace containers for 4 using (path '/db2/bpfdb/4')"
SQL0299N  Container is already assigned to the table space.  SQLSTATE=42731
bash-3.2$ db2 "set tablespace containers for 5 using (path '/db2/bpfdb/5')"
SQL0299N  Container is already assigned to the table space.  SQLSTATE=42731
bash-3.2$ 

 Type                                 = System managed space
 Contents                             = User Temporary data
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

bash-3.2$ db2 restore database  bpfdb continue
SQL2519N  The database was restored but the restored database was not migrated 
to the current release.  Error "-1006" with tokens " 3  j                      
" is returned.
bash-3.2$ db2 migrate db  bpfdb
SQL1006N  The code page "648535941224547762I" of the application does not 
match the code page "648535941224547765I" of the database.



bash-3.2$ db2set db2codepage=1386
bash-3.2$ db2 terminate 
DB20000I  The TERMINATE command completed successfully.
bash-3.2$ db2 migrate db  bpfdb
DB20000I  The MIGRATE DATABASE command completed successfully.
bash-3.2$ db2 connect to bpfdb 

   Database Connection Information

 Database server        = DB2/AIX64 9.5.7
 SQL authorization ID   = DB2INST1
 Local database alias   = BPFDB

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11134849/viewspace-688005/,如需轉載,請註明出處,否則將追究法律責任。

相關文章