If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > restore db

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-03, 10:17
jagan_5378 jagan_5378 is offline
Registered User
 
Join Date: Nov 2003
Posts: 68
restore db

hi to all
i want to restore my database in my system 162.100.100.120.
how to restore ? in my system.
i have a backimage of testkala database that is from 162.100.100.130
.
when i was i try to restore the database that time bad container path error will come .
i checked all the paths of table spaces in that system and create
same folders here.
in 162.100.100.130 two hard disk is there . in that one table space is created in /dev/raw/ device.

in my sytem (162.100.100.120) i create /dev/raw device.
while restoring can i mention the paths of table spaces

but is giving error .
pl tell me y ?

thank u
Reply With Quote
  #2 (permalink)  
Old 12-17-03, 10:45
cchattoraj cchattoraj is offline
Registered User
 
Join Date: Mar 2003
Posts: 343
Please post version of db2 and OS.

Though the kind of help you need is not very clear, it appears that you need to do a redirected restore which means that you are trying to restore a database to another database. Please lookup the backup database command in the command ref.
Reply With Quote
  #3 (permalink)  
Old 12-17-03, 20:11
udb_dba udb_dba is offline
Registered User
 
Join Date: Oct 2003
Posts: 29
In this case Redirected restore is the only solution immeterial to DB2 Version where we can specify the container path and names.

-Racha
Reply With Quote
  #4 (permalink)  
Old 12-18-03, 00:37
jagan_5378 jagan_5378 is offline
Registered User
 
Join Date: Nov 2003
Posts: 68
linux version 6.2

my backup image is

TESTKALA.0.db2inst1.NODE0000.CATN0000.200310222142 51.001
pl tell me with example how to restore database .
while restoreing database i should be able to redirect the path.

pl tell me
Reply With Quote
  #5 (permalink)  
Old 12-18-03, 03:23
VolkerK VolkerK is offline
Registered User
 
Join Date: Dec 2003
Location: Duesseldorf - Germany - Europe - Earth - Galaxy
Posts: 18
restore redirect

Hi there,

try

restore database <name> from <path> redirect

Each tablespace will have to get it's containers defined before proceeding. You are implicitly connected to the database at this moment. Never issue an explicit connect, because it will cause an error and you loose your implicit connection and have to start again ;-)

use this commant for each tablespace:

set tablespace containers for <number> using
(path '/db2/data1/<mydbname>/<mytablespace>',
[...]
path '/db2/datan/<mydbname>/<mytablespace>') ;


When there's no tablespace left with containers to be defined issue

restore database <name> continue.

Regards,
Volker.
Reply With Quote
  #6 (permalink)  
Old 12-18-03, 05:30
jagan_5378 jagan_5378 is offline
Registered User
 
Join Date: Nov 2003
Posts: 68
hi
now pl tell how to restore this in my system(162.100.100.120)

i want to restore my database in 162.100.100.120 from 162.100.100.130
present no database is there in 162.100.100.120 .
only db2 is there.

this is backup image of 162.100.100.130 system .
now i want to restore database in 162.100.100.120 system

LIST TABLESPACE CONTAINERS
in 162.100.100.130 system

IST TABLESPACE CONTAINERS FOR 0 SHOW DETAIL

Tablespace Containers for Tablespace 0

Container ID = 0
Name = /Kala/db2inst1/db2inst1/NODE0000/SQL00003/SQLT0000.0 Type = Path
Total pages = 23311
Useable pages = 23311
Accessible = Yes


LIST TABLESPACE CONTAINERS FOR 1 SHOW DETAIL

Tablespace Containers for Tablespace 1

Container ID = 0
Name = /Kala/db2inst1/db2inst1/NODE0000/dytab.f1
Type = File
Total pages = 256000
Useable pages = 255968
Accessible = Yes
Container ID = 1
Name = /Kalai/db2inst1/db2inst1/NODE0000/dytab.f2
Type = File
Name = /Kalanjali/db2inst1/db2inst1/NODE0000/dytab.f2
Type = File
Total pages = 256000
Useable pages = 255968
Accessible = Yes


LIST TABLESPACE CONTAINERS FOR 2 SHOW DETAIL

Tablespace Containers for Tablespace 2

Container ID = 0
Name = /dev/raw/raw1
Type = Disk
Total pages = 1408000
Useable pages = 1407968
Accessible = Yes


LIST TABLESPACE CONTAINERS FOR 3 SHOW DETAIL

Tablespace Containers for Tablespace 3

Container ID = 0
Name = /db2temp/tabsp/temp1
Container ID = 0
Name = /db2temp/tabsp/temp1
Type = File
Total pages = 256000
Useable pages = 255968
Accessible = Yes
Container ID = 1
Name = /db2temp/tabsp/temp2
Type = File
Total pages = 256000
Useable pages = 255968
Accessible = Yes
Container ID = 2
Name = /db2temp/tabsp/temp3
Type = File
Total pages = 256000
Useable pages = 255968
Accessible = Yes
Container ID = 3
Name = /db2temp/tabsp/temp4
Type = File
Total pages = 256000
Useable pages = 255968
Accessible = Yes
~

pl tell me how restore the database in my system.
Reply With Quote
  #7 (permalink)  
Old 12-18-03, 10:35
VolkerK VolkerK is offline
Registered User
 
Join Date: Dec 2003
Location: Duesseldorf - Germany - Europe - Earth - Galaxy
Posts: 18
Quote:
i want to restore my database in 162.100.100.120 from 162.100.100.130
present no database is there in 162.100.100.120 .
only db2 is there.
Ok, then...

- login at 162.100.100.130 as isntance owner.
- force all applications (if any)
- "backup database <name> to <path>". where path is wherever you have nough space for a backup
- login at 162.100.100.120 as isntance owner
- use ftp to transfer the backup image
- use the "restore redirect" as stated in my first posting
- decide on which path to put the data
- restore the header information with "restore database <name> from <path> redirect"
- issue one "set tablespace containers" for each tablespace
- continue the backup with "restore database <name> continue"

Which step will be a problem?

Regards,
Volker.
Reply With Quote
  #8 (permalink)  
Old 12-18-03, 23:52
jagan_5378 jagan_5378 is offline
Registered User
 
Join Date: Nov 2003
Posts: 68
hi

hi VolkerK
thank u very much for u r reply.


restore database testkala from /db2temp taken at 20030812145940 redirect without rolling forward
SQL1277N Restore has detected that one or more table space containers are
inaccessible, or has set their state to 'storage must be defined'.
DB20000I The RESTORE DATABASE command completed successfully.

2).after issue one "set tablespace containers" for each tablespace
pl tell me how to proced for above step.

for set tablespace containers my 162.100.100.120 system what i have to do?

thank u.
Reply With Quote
  #9 (permalink)  
Old 12-19-03, 02:41
VolkerK VolkerK is offline
Registered User
 
Join Date: Dec 2003
Location: Duesseldorf - Germany - Europe - Earth - Galaxy
Posts: 18
Hi Jagan,

each tablespace has an ID. Decide where to store the database files and issue for each tablespace one command like this:

set tablespace containers for <ID> using
(path '/db2/data1/<mydbname>/<mytablespace>',
[...]
path '/db2/datan/<mydbname>/<mytablespace>') ;
You can use one pathname or more for SMS tablespaces (in case you want I/O-parallelism).

Remember: All commands associated with a single redirected restore must be executed from the same window or CLP session.

For DMS tablespaces you can use raw devices or named files. Anthough you can't convert a DMS tablespace to an SMS one, but you can relocate a raw device into a file-based container. The manual says:

Quote:
(FILE|DEVICE 'container-string' number-of-pages,...)
For a DMS tablespace, identifies one or more containers that will belong to the tablespace and into which the tablespace's data will be stored. The type of the container (either FILE or DEVICE) and its size (in PAGESIZE pages) are specified. The size can also be specified as an integer value followed by K (for kilobytes), M (for megabytes) or G (for gigabytes). If specified in this way, the floor of the number of bytes divided by the pagesize is used to determine the number of pages for the container. A mixture of FILE and DEVICE containers can be specified. The container-string cannot exceed 254 bytes in length.

For a FILE container, the container-string must be an absolute or relative file name. The file name, if not absolute, is relative to the database directory. If any component of the directory name does not exist, it is created by the database manager. If the file does not exist, it will be created and initialized to the specified size by the database manager. When a tablespace is dropped, all components created by the database manager are deleted.
So you can use

(file '/db2/data1/<mydbname>/<mytablespace>' ...)
as container string if it is a raw device.

Hope you'll manage it,
have a nive weekend.

Regards,
Volker.
Reply With Quote
  #10 (permalink)  
Old 12-19-03, 04:25
gemini95117 gemini95117 is offline
Registered User
 
Join Date: Dec 2002
Location: PUNE, INDIA
Posts: 25
Re: hi

Quote:
Originally posted by jagan_5378
hi VolkerK
thank u very much for u r reply.


restore database testkala from /db2temp taken at 20030812145940 redirect without rolling forward
SQL1277N Restore has detected that one or more table space containers are
inaccessible, or has set their state to 'storage must be defined'.
DB20000I The RESTORE DATABASE command completed successfully.

2).after issue one "set tablespace containers" for each tablespace
pl tell me how to proced for above step.

for set tablespace containers my 162.100.100.120 system what i have to do?

thank u.

restore db DB_BACKUP TO NEW_TARGET_PATH into TARGET_NEWDB REDIRECT
set tablespace containers for 0 using (PATH '<PATH>') -- This is for System Managed Tablespaces
set tablespace containers for n using (PATH '<PATH>') -- This is for System Managed Tablespaces

set tablespace containers for 0 using (FILE '<PATH>' <SIZE>) -- This is for Database Managed Tablespaces
set tablespace containers for n using (FILE '<PATH>' <SIZE>) -- This is for Database Managed Tablespaces


Hope, this should help ...
Reply With Quote
  #11 (permalink)  
Old 12-19-03, 05:25
Ravi Ravi is offline
Registered User
 
Join Date: Jul 2001
Location: Bangalore, India
Posts: 28
also plz add "restore db DB_BACKUP continue" after completing "SET TABLESPACE ..." commands for all tablespaces

Ravi
Reply With Quote
  #12 (permalink)  
Old 12-19-03, 05:32
gemini95117 gemini95117 is offline
Registered User
 
Join Date: Dec 2002
Location: PUNE, INDIA
Posts: 25
Quote:
Originally posted by Ravi
also plz add "restore db DB_BACKUP continue" after completing "SET TABLESPACE ..." commands for all tablespaces

Ravi

Thanks Ravi, Yea, I missed that.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On