Wednesday, May 09, 2007

Load Sybase Database From Tape

On occasion, you may have to restore a database from a tape. This is a fairly simple and straightforward task to perform. Here is the syntax to load a Sybase database from tape.

First, get a list of the database filename(s) on the tape

# isql -Usa -Ppassword
1> load database MYDB from mytapealias with listonly
2> go

Next, restore the database from tape and then put it online

1> use master
2> go
1> load database MYDB from mytapealias with file = 'MYDBXXXXXXX'
2> go
1> online database MYDB
2> go

4 comments:

Bluewake said...

Many thanks for your post, was so usefull :). I had load a dump but my database was offline your instructions help me to solve the problem.

esofthub said...

That's great bluewake and glad to have helped. If you have any other questions, let me know or browse the blog.

Mick said...

I've run into a "project" where I have to pull a bunch of OLD data out of one of our databases. What I have is end-of-year tapes of our production database, and I need to load the old data off the tape, and bring it online to get all the old stats.

All this, and I can't upset the production DB in the process. Am I able to pull the files off the tape, and then load them into a new database somehow? With the load database command, can I send the data to a different database, named something different than our production DB?

Thanks - I've taken quite a few tips from your blog, it's been great!

esofthub said...

mick,

I think we did something like that a few years ago but here's what I think...

The newly created and uniquely named database needs be as large or larger (most likely) than the original database when you load its existing db dump from tape. Then bring the new db online.

Do you have another DBMS environment (test) on a workstation outside your production db? That would be a safer option. I would strongly recommend doing this outside your production environment if all possible.