Backup/restore SQL Express DB - command line
Backup/Restore of RF Code Database in MS SQL without Microsoft SQL Management Studio
It may be necessary to backup and/or restore an RF Code SQL DB without the luxury of pointing and clicking using the SQL Management Studio. Below are the simple SQL commands to run from the Windows SQL Server.
To backup an RF Code DB called “daytona” (default name of the RF Code DB during install) to a file named c:\sqlback.bak, issue the following command on a Windows Command (cmd) prompt on the SQL Server, which may or may not be on the same server as the Asset Manager:
SQL Express 2008 Syntax:
“localhost\RFCASSETMGR”= Installed by default by Asset Manager software, “RFCASSETMGR” is the Database “instance” running on the local server (i.e. “localhost”). The actual database name, running within the SQL instance is “daytona”.
SQL Express 2005 Syntax:
"-Usa" = User "sa", when prompted, enter the login for the "sa" user of the DB, which by default is "Object00"
Restore the DB
Restoring a DB is as simple, simply enter the following command on the destination SQL server (if not the same one). In this example we’re assuming the DB is called “daytona” on the local server where the SQL DB needs to be restored to. The “WITH REPLACE” option over-writes the existing “daytona” database:
If during the Backup or Restore process an “Operating system error 5(Access is denied.)” error occurs, you need to modify the Windows Service (SQL Server (RFCASSETMGR)) to run as a “Local System account.”