sqllogship Application The sqllogship application performs a backup, copy, or restore operation and associated clean-up tasks for a log shipping configuration. The operation is performed on a specific instance of Microsoft SQL Server 2005 for a specific database. For the syntax conventions, see Command Prompt Utility Reference (Database Engine).

Syntax
sqllogship -server instance_name { -backup primary_id | -copy secondary_id | -restore secondary_id } [ –verboselevel level ] [ –logintimeout timeout_value ] [ -querytimeout timeout_value ]

Arguments
- -serverinstance_name
Specifies the instance of SQL Server where the operation will run. The server instance to specify depends on which log-shipping operation is being specified. For -backup, instance_name must be the name of the primary server in a log shipping configuration. For -copy or -restore, instance_name must be the name of a secondary server in a log shipping configuration. - -backupprimary_id
Performs a backup operation for the primary database whose primary ID is specified by primary_id. You can obtain this ID by selecting it from the log_shipping_primary_databases system table or by using the sp_help_log_shipping_primary_database stored procedure. The backup operation creates the log backup in the backup directory. The sqllogship application then cleans out any old backup files, based on the file retention period. Next, the application logs history for the backup operation on the primary server and the monitor server. Finally, the application runs sp_cleanup_log_shipping_history, which cleans out old history information, based on the retention period. - -copysecondary_id
Performs a copy operation to copy backups from the specified secondary server for the secondary database, or databases, whose secondary ID is specified by secondary_id. You can obtain this ID by selecting it from the log_shipping_secondary system table or by using the sp_help_log_shipping_secondary_database stored procedure. The operation copies the backup files from the backup directory to the destination directory. The sqllogship application then logs the history for the copy operation on the secondary server and the monitor server. - -restoresecondary_id
Performs a restore operation on the specified secondary server for the secondary database, or databases, whose secondary ID is specified by secondary_id. You can obtain this ID by using the sp_help_log_shipping_secondary_database stored procedure. Any backup files in the destination directory that were created after the most recent restore point are restored to the secondary database, or databases. The sqllogship application then cleans out any old backup files, based on the file retention period. Next, the application logs history for the restore operation on the secondary server and the monitor server. Finally, the application runs sp_cleanup_log_shipping_history, which cleans out old history information, based on the retention period. - –verboselevellevel
Specifies the level of messages added to the log shipping history. level is one of the following integers: Level | Description |
|---|
0 | Output no tracing and debugging messages. | 1 | Output error-handling messages. | 2 | Output warnings and error-handling messages. | 3 | Output informational messages, warnings, and error-handling messages. This is the default value. | 4 | Output all debugging and tracing messages. |
- –logintimeouttimeout_value
Specifies the amount of time allotted for attempting to log in to the server instance before the attempt times out. The default is 15 seconds. timeout_value is int. - -querytimeouttimeout_value
Specifies the amount of time allotted for starting the specified operation before the attempt times out. The default is no timeout period. timeout_value is int.

Remarks
We recommend that you use the backup, copy, and restore jobs to perform the backup, copy and restore when possible. To start these jobs from a batch operation or other application, call the sp_start_job stored procedure. The log shipping history created by sqllogship is interspersed with the history created by log shipping backup, copy, and restore jobs. If you plan to use sqllogship repeatedly to perform backup, copy, or restore operations for a log shipping configuration, consider disabling the corresponding log shipping job or jobs. For more information, see Disable or Enable a Job. The sqllogship application, SqlLogShip.exe, is installed in the x:\Program Files\Microsoft SQL Server\90\Tools\Binn directory.

Permissions
sqllogship uses Windows Authentication. The Windows Authentication account where the command is run requires Windows directory access and SQL Server permissions. The requirement depends on whether the sqllogship command specifies the -backup, -copy, or -restore option. Option | Directory access | Permissions |
|---|
-backup | Requires read/write access to the backup directory. | Requires the same permissions as the BACKUP statement. For more information, see BACKUP (Transact-SQL). | -copy | Requires read access to the backup directory and write access to the copy directory. | Requires the same permissions as the sp_help_log_shipping_secondary_database stored procedure. | -restore | Requires read/write access to the copy directory. | Requires the same permissions as the RESTORE statement. For more information, see RESTORE (Transact-SQL). |
Note |
|---|
To find out the paths of the backup and copy directories, you can run the sp_help_log_shipping_secondary_database stored procedure or view the log_shipping_secondary table in msdb. The paths of the backup directory and destination directory are in the backup_source_directory and backup_destination_directory columns, respectively. |

See Also
|
Anwendung sqllogship Von der Anwendung sqllogship werden ein Sicherungs-, Kopier- oder Wiederherstellungsvorgang und zugeordnete Cleanuptasks für eine Protokollversandkonfiguration ausgeführt. Der Vorgang wird in einer bestimmten Instanz von Microsoft SQL Server 2005 für eine bestimmte Datenbank ausgeführt. Informationen zu den Syntaxkonventionen finden Sie unter Referenz zum Eingabeaufforderungs-Hilfsprogramm (Datenbankmodul).

Syntax
sqllogship -server instance_name { -backup primary_id | -copy secondary_id | -restore secondary_id } [ –verboselevel level ] [ –logintimeout timeout_value ] [ -querytimeout timeout_value ]

Argumente
- -serverinstance_name
Gibt die Instanz von SQL Server an, in der der Vorgang ausgeführt wird. Die anzugebende Serverinstanz hängt vom angegebenen Protokollversandvorgang ab. Für -backup muss instance_name der Name des primären Servers in einer Protokollversandkonfiguration sein. Für -copy oder -restore muss instance_name der Name eines sekundären Servers in einer Protokollversandkonfiguration sein. - -backupprimary_id
Führt einen Sicherungsvorgang für die primäre Datenbank aus, deren primäre ID durch primary_id angegeben ist. Sie können diese ID abrufen, indem Sie sie aus der log_shipping_primary_databases-Systemtabelle auswählen oder die gespeicherte Prozedur sp_help_log_shipping_primary_database verwenden. Bei diesem Sicherungsvorgang wird die Protokollsicherung im Sicherungsverzeichnis erstellt. Für die veralteten Sicherungsdateien wird dann auf der Grundlage der Beibehaltungsdauer der Datei von der Anwendung sqllogship ein Cleanup ausgeführt. Anschließend wird der Verlauf für den Sicherungsvorgang von der Anwendung auf dem primären Server und dem Überwachungsserver protokolliert. Abschließend wird von der Anwendung sp_cleanup_log_shipping_history ausgeführt, sodass auf der Grundlage der Beibehaltungsdauer veraltete Verlaufsinformationen gelöscht werden. - -copysecondary_id
Führt einen Kopiervorgang aus, um Sicherungen vom angegebenen sekundären Server für die sekundäre Datenbank bzw. sekundären Datenbanken zu kopieren, deren sekundäre ID durch secondary_id angegeben ist. Sie können diese ID abrufen, indem Sie sie aus der log_shipping_secondary-Systemtabelle auswählen oder die gespeicherte Prozedur sp_help_log_shipping_secondary_database verwenden. Bei dem Vorgang werden die Sicherungsdateien aus dem Sicherungsverzeichnis in das Zielverzeichnis kopiert. Dann wird der Verlauf für den Kopiervorgang von der Anwendung sqllogship auf dem sekundären Server und dem Überwachungsserver protokolliert. - -restoresecondary_id
Führt auf dem angegebenen sekundären Server einen Wiederherstellungsvorgang für die sekundäre Datenbank bzw. sekundären Datenbanken aus, deren sekundäre ID durch secondary_id angegeben ist. Sie können diese ID mithilfe der gespeicherten Prozedur sp_help_log_shipping_secondary_database abrufen. Alle Sicherungsdateien im Zielverzeichnis, die nach dem letzten Wiederherstellungspunkt erstellt wurden, werden in der sekundären Datenbank bzw. in den sekundären Datenbanken wiederhergestellt. Für die veralteten Sicherungsdateien wird dann auf der Grundlage der Beibehaltungsdauer der Datei von der Anwendung sqllogship ein Cleanup ausgeführt. Anschließend wird der Verlauf für den Wiederherstellungsvorgang von der Anwendung auf dem sekundären Server und dem Überwachungsserver protokolliert. Abschließend wird von der Anwendung sp_cleanup_log_shipping_history ausgeführt, sodass auf der Grundlage der Beibehaltungsdauer veraltete Verlaufsinformationen gelöscht werden. - –verboselevellevel
Gibt die Ebene der dem Protokollversandverlauf hinzugefügten Meldungen an. level entspricht einer der folgenden ganzen Zahlen: Ebene | Beschreibung |
|---|
0 | Keine Ausgabe von Ablaufverfolgungs- oder Debugmeldungen | 1 | Ausgabe von Fehlerbehandlungsmeldungen | 2 | Ausgabe von Warnungen und Fehlerbehandlungsmeldungen | 3 | Ausgabe von Informationsmeldungen, Warnungen und Fehlerbehandlungsmeldungen. Dies ist der Standardwert. | 4 | Ausgabe aller Debug- und Ablaufverfolgungsmeldungen |
- –logintimeouttimeout_value
Gibt die für das Anmelden an der Serverinstanz vorgesehene Zeit an, bevor für den Versuch ein Timeout auftritt. Der Standardwert ist 15 Sekunden. timeout_value ist vom Datentyp int. - -querytimeouttimeout_value
Gibt die für das Starten des angegebenen Vorgangs vorgesehene Zeit an, bevor für den Versuch ein Timeout auftritt. Der Standard ist kein Timeout. timeout_value ist vom Datentyp int.

Hinweise
Verwenden Sie zum Sichern, Kopieren und Wiederherstellen nach Möglichkeit die Sicherungs-, Kopier- und Wiederherstellungsaufträge. Rufen Sie die gespeicherte Prozedur sp_start_job auf, um diese Aufträge aus einem Batchvorgang oder einer anderen Anwendung zu starten. Der von sqllogship erstellte Protokollversandverlauf wird in den vom Protokollversand-Sicherungsauftrag, -Kopierauftrag und -Wiederherstellungsauftrag erstellten Verlauf eingefügt. Wenn Sie sqllogship wiederholt zum Ausführen von Sicherungs-, Kopier- und Wiederherstellungsvorgängen für eine Protokollversandkonfiguration verwenden möchten, sollten Sie den entsprechenden Protokollversandauftrag bzw. die entsprechenden Protokollversandaufträge deaktivieren. Weitere Informationen finden Sie unter Deaktivieren oder Aktivieren eines Auftrags. Die Anwendung sqllogship, SqlLogShip.exe, ist im Verzeichnis x:\Programme\Microsoft SQL Server\90\Tools\Binn installiert.

Berechtigungen
Für sqllogship wird die Windows-Authentifizierung verwendet. Für das Windows-Authentifizierungskonto zum Ausführen des Befehls sind ein Windows-Verzeichniszugriff und SQL Server-Berechtigungen erforderlich. Die Anforderung hängt davon ab, ob der Befehl sqllogship die Option -backup, -copy oder -restore angibt. Option | Verzeichniszugriff | Berechtigungen |
|---|
-backup | Erfordert Lese-/Schreibzugriff auf das Sicherungsverzeichnis. | Erfordert dieselben Berechtigungen wie die BACKUP-Anweisung. Weitere Informationen finden Sie unter BACKUP (Transact-SQL). | -copy | Erfordert Lesezugriff auf das Sicherungsverzeichnis und Schreibzugriff auf das Kopieverzeichnis. | Erfordert dieselben Berechtigungen wie die gespeicherte Prozedur sp_help_log_shipping_secondary_database. | -restore | Erfordert Lese-/Schreibzugriff auf das Kopieverzeichnis. | Erfordert dieselben Berechtigungen wie die RESTORE-Anweisung. Weitere Informationen finden Sie unter RESTORE (Transact-SQL). |
Hinweis |
|---|
Zum Ermitteln des Pfads der Sicherungs- und Kopieverzeichnisse können Sie die gespeicherte Prozedur sp_help_log_shipping_secondary_database ausführen oder die log_shipping_secondary-Tabelle in msdb anzeigen. Der Pfad des Sicherungsverzeichnisses und des Zielverzeichnisses befindet sich in der backup_source_directory-Spalte bzw. in der backup_destination_directory-Spalte. |

Siehe auch
|