One task you can undertake to ease recreation of the SAP Sybase Adaptive Server Enterprise (ASE) database in the event something disastrous happens is to create backup copies of the database creation statements.
If, for example, you must do a complete rebuild of the database, you will need to recreate the databases blank prior to the restoration. If the database is not already available, it will need to be recreated. When you maintain scripts of the databases, you will be able to very rapidly recreate the database in such circumstances.
You can recreate the database using ddlgen:
Ddlgen -U<username> -P<password> -S<Servername> -TDB -N% Ddlgen -U<username> -P<password> -S<Servername> -TDB -N<databasename>
The ddlgen command shown here provides more information than you’ll need in recreating the database, including creation statements for all objects in the database. If you are just restoring the backup, all that is required initially is the create database statements. You can, if you choose, copy only the parts of the create database script you need. This should include all of the create and alter database commands.
Note that the database will not be created “for load.” When the create database command is executed, the disk space is initialized for database usage. However, if the purpose is to create an empty database shell to load a backup, you don’t need to initialize the disk space because the load database command will do that. You can save time by skipping the redundant steps. If you’re working with a small database, the time saved may not be much, but for a large database, using this option this can decrease the time needed for the operation by as much as hours.
Here is an example of the command to create the database for recovery:
create database pubs2 ondatadev='3m' log on logdev='0.5g' create database pubs2 ondatadev='3m' log on logdev='0.5g' for load
Leave a Reply