NSRSYBRC(8)

NAME
nsrsybrc - recover Sybase database(s) from NetWorker.

SYNOPSIS
nsrsybrc [ -hkqv? ] [ -U user-name ] [ -P password ] [ -d SYBASE:/sql-server-name[ /database-name ] ] [ -s server ] [ -c client-name ] [ -t date ] [ -D debug-level ] { SYBASE:/sql-server-name | SYBASE:/sql-server-name/database-name [ SYBASE:/sql-server-name/database-name ... ] }

DESCRIPTION
nsrsybrc restores Sybase SQL Server 11.0 and later databases from NetWorker. The progress of a nsrsybrc can be monitored using the X Window System based nwadmin(8) program or the curses(3X) based nsrwatch(8) program for other terminal types.

The database(s) to be restored are specified by the SYBASE:/sql-server-name[/database-name] value. The database-name is optional; if omitted, all databases on the SQL Server will be restored except the master database.

This command should be issued from the same operating system userid that launched the Sybase Backup Server. That is the userid that owns the backups, and it should be used to restore them. Other operating system userids may be unable to see the savesets that the Sybase Backup Server created.

Note that the master database must be restored before the other system and user databases. The order for restoring a complete SQL Server system is to first restore the master database and then to restore the remainder of the databases. In order to restore the master database, you must restart the SQL Server in master recovery mode (the -m option of startserver.) Using nsrsybrc, you would first issue the command:
 nsrsybrc -U sa -P password SYBASE:/sql-server-name/master Once this successfully restores the master database, the SQL Server will automatically shut itself down. You will need to restart the SQL server and restore the rest of the databases with the
 nsrsybrc -U sa -P password SYBASE:/sql-server-name command. This will restore the rest of the system databases and the user databases.

Exercise extreme caution when restoring the master database. If you are restoring it to a new database, remember that it has path names to the device files. If you restore the master database to another SQL Server on the same machine, the new SQL Server will attempt to use the same device files as the old SQL Server.

The user-name and password provide the information necessary to log in to the SQL Server to be restored. The user-name must have sufficient permissions to perform database loads on the databases to be restored.

OPTIONS

-k  Perform a database consistency check on each database once it is restored. The results of the database consistency check are written to stdout. The default is not to perform a database consistency check, and if this option is supplied, the consistency check is done with the default options described in the man page for nsrsybcc(8).

-h  Display usage.

-v  Verbose. Cause the nsrsybrc program to tell you in great detail what it is doing as it proceeds.

-?  Display usage.

-q  Quiet. Display only summary information and error messages.

-U user-name
    Specify the SQL Server user that will perform the backups.

-P password
    Specifies the password for the SQL Server user that will perform the backups.

-d SYBASE:/sql-server-name[ /database-name ]
    Specify a new destination for this database. If this option is not set, the database is restored to its original SQL Server and database name. If this option is specified, the database is restored to this new destination. This can be used to restore a database to a new SQL Server and database name or a new database name in the same SQL Server. If a new destination is supplied, only one database name (or sql-server-name) can be specified on the command line for this restore. The destination database(s) must already exist; nsrsybrc does not create them automatically. For the fastest loading, new databases created to be restored to should be created with the "for load" option.

-s server
    Specify which machine to use as the NetWorker server.

-c client-name
    Specify the client name for starting the restore session. This is useful on clients with multiple network interfaces, and hence multiple host names. It can be used to use multiple index databases for the same physical client. Note that this does not specify the network interface to use. This is specified in the server network interface attribute of the client resource (see nsr_client(5)).

-D debug-level
    Set the NSR_DEBUG_LEVEL for this command. Valid values range from 0 (no information) to 10 (much information.) The default value is 2.

-t date
    This specifies the date and time to restore to. The default for this is the current date and time. If the SQL Server is Sybase Adaptive Server version 11.5 or later, and the database supports transaction log backups, this time will be used as the "until_time" that the database will be restored to. In Sybase SQL Server 11.x Systems earlier than 11.5, the database will be restored to the latest time possible that is not after the date supplied.

EXAMPLES

Restoring a database:
    To restore the model database in SQL Server "production" to the current time from the NetWorker Server called "networker", use the following command:
    nsrsybrc -U sa -P password -s networker SYBASE:productionmodel

Restoring the master database:
    To restore the master database in server "production" to the current time, restart "production" in master recover mode (with the "-m" option) and issue the command
    nsrsybrc -U sa -P password -s networker SYBASE:productionmaster

    Once the master database is restored, the SQL Server will shut itself down. To restore the rest of the databases, restart the SQL Server and issue the command
    nsrsybrc -U sa -P password -s networker SYBASE:production

    This will restore the rest of the databases on the production SQL Server.

Restoring a database to a new server:
    To restore a database to a new server, use the "-d" option to specify the new server name. To restore the database "accounting" from "production" to "test", issue the command
    nsrsybrc -U sa -P password -s networker -d SYBASE:testaccounting SYBASE:productionaccounting

    The destination database must already exist in the server, and the user name and password are ones that apply to the test server.

SEE ALSO
curses(3X), nsr_getdate(3), nwadmin(8), nsr(5), nsr(8), nsr_client(5), nsr_device(5), nsr_group(5), nsr_service(5), nsrd(8), nsrim(8), nsrindexd(8), nsrmm(8), nsrmmd(8), nsrsyb(8), nsrsybcc(8), nsrsybsv(8), nsrwatch(8), recover(8), savefs(8), savegrp(8)

DIAGNOSTICS

  Exit Codes
0   Normal exit. This means that the database(s) were correctly restored.
1   Abnormal exit. The database(s) were not all restored.

  Messages
This is a partial listing of common error messages. Refer to the Administrator's Guide for more complete listing of error messages and how to resolve them.

The context allocation routine failed...
    Cannot access file /sybase/config/objectid.dat This message indicates that the $SYBASE environment variable was not set. This environment variable needs to be set so that nsrsybrc can find the Sybase localization files required at runtime. The $SYBASE environment variable should be set to the directory where Sybase was installed (the one where the interfaces file is.) This error may also appear if the Sybase Open Client software is not installed. Sybase Open Client must be installed for nsrsybrc to run.

Archive API error...Unable to open API library for device...
    Library path is /sybase/lib/libbms.ext This message indicates that the symbolic link to the libbms.ext library is missing from the $SYBASE/lib directory. Make sure the link exists. The libbms.ext file to link to is in the same directory as the NetWorker binary files.

Archive API error...Attempting to open byte stream device...
    network error (Severity 5 Number 12): Business Suite Module for Sybase has not been properly enabled. This message indicates that the server from which you are restoring is not enabled for Sybase. Install an enabler for the Sybase module on the server and retry the operation.

Archive API error...Attempting to open byte stream device...
    network error (Severity 5 Number 13): client is not a registered client This message indicates that the client on which nsrsybrc is being run is not a registered client of the server from which the backup is to be restored. Create a client resource for this client on the server and retry the operation.

Error: no backup was found for database database-name
    This message indicates that there are no backups found for the database requested. Make sure that the Operating System user used to restore the backups is the same as the one that created the backups. Use nsrinfo to see the objectowner field for each backup. The objectowner is the Operating System user that must restore the data.

Error from server: Msg 3108, Level 16, State 1
    LOAD DATABASE must be used in single user mode if trying to restore the Master database. In order to restore the master database, the SQL Server needs to be restarted in single user mode. Shut down the SQL Server and restart it with the -m option.

CT_LIBRARY error: ...operation terminated due to disconnect
    CT_LIBRARY error: ...The connection has been marked dead. These messages are expected when the master database is recovered. They indicate that the SQL Server has shut down on the successful restoration of the master database. The SQL Server will need to be restarted in order to restore the user databases or in order to make it available to users.

Not restoring database master.  It needs to be loaded
    separately before the rest of the instance is loaded. This message indicates that the entire SQL server is being restored (because no database-name was specified on the command line), and that the master database will not be restored. The master database must be restored before all of the other databases, and it will shut down the SQL Server once it is restored. Therefore, no other databases can be restored at the same time as master.

Error from server: Msg number, Level number, State number
    Error text This message indicates that there was an error message returned from Sybase. Refer to the Sybase Troubleshooting and Errors Guide for an explanation of the error and its resolution.