mount

Description

Attaches a database to a destination or secondary Adaptive Server.

The mount command decodes the information in the manifest file and makes the set of databases available. The mount command differs from other copying procedures such as the bcp bulk copy utility in that all required supporting activities are executed, including adding database devices, if necessary, and activating them, creating the catalog entries for the new databases, and recovering them.

If you are using different device names at the destination Adaptive Server when mounting the databases, use mount with listonly and modify the device path names at the destination server. Then use mount to actually mount the databases.

NoteFor every login that is allowed access to a database on the original Adaptive Server, it is more convenient to have a corresponding login for the same suid at the destination Adaptive Server, as this avoids user ID reconciliation issues.

For permissions to remain unchanged, the login maps at the destination Adaptive Server must be identical to that on the source Adaptive Server. For more information on login maps, see Chapter 15, “Managing Remote Servers” in System Administration Guide, Volume 1.

Syntax

mount database all | database_mapping[, database_mapping, ...]
	from "manifest_file" 
	[using device_mapping [, device_mapping...] 
		[with listonly]
	database_mapping:
			origdbname as newdbname
		|	newdbname = origdbname
		|	origdbname
		|	newdbname
	device_mapping
			logical_device_name as new_physical_name
		|	new_physical_name = logical_device_name
		|	original_physical_name
		|	new_physical_name

Parameters

manifest_file

The manifest file is the binary file that describes the databases that are present on a set of database devices.

Operations that can perform character translations of the file contents (such as ftp) corrupt the manifest file unless performed in binary mode.

Examples

Example 1

Finds the path names listed on the manifest file from the source Adaptive Server:

mount database all from "/data/sybase2/mfile1" with listonly
go
[database]
  mydb
[device]
  "/data/sybase1/d0.dbs" = "1dev1"
  "/data/sybase2/d14.dbs" = "1dev13"

When you use the path names different from the source ones, verify or modify them to meet your criteria at the destination Adaptive Server.

Example 2

After the database devices are copied to the secondary Adaptive Server, you then mount it:

mount database all from "/data/sybase2/mfile1" using     "/data/sybase2/d0.dbs" = "1dev1", 
    "/data/sybase2/d14.dbs" = "1dev13"

When the mount process has completed, the database or databases are still offline. Use the online database command to bring them online. You need not restart the server.

Example 3

The destination server can be the same as the source server. In this case, the database names must be mapped to a different name, and the logical device names will be internally renamed.

  1. Create an exact copy of database mydb in the same server:

    1> quiesce database mydb_tag hold mydb for external dump to 
       "/data/mydb.manifest"
    2> go
    
  2. Copy the OS file:

    $ cp /data/sybase2/mydb.dbs /data/sybase2/mydb_copy.dbs
    
  3. You can now mount it as a copy:

    1> quiesce database mydb_tag release
    2> go
    1> mount database mydb as mydb_copy
    2> from "/data/mydb.manifest"
    3> using mydb_dev as "/data/sybase2/mydb_copy.dbs"
    3> go
    

The physical device //data/sybase2/mydb_copy.dbs/ is automatically assigned a machine-generated logical name with the format Cccc$<mydb_dev> where:

Database IDs for the transported databases should not exist on the destination Adaptive Server. Because the database has been mounted on the same server, the database ID had to be changed. The allocation pages in the mounted device keep the original database ID, and that information is used by the disk refit command. Use the dbcc checkalloc command to reconcile the dbid after running mount database so that disk refit can work on the mounted devices. Run checkalloc if the database is not being mounted for temporary use.

Usage


Cluster Edition

mount database and unmount database are supported in the Cluster Edition. If an instance fails while one of these commands is in progress, the command may abort. In this case, the user must re-issue mount database or unmount database when the instance failover recovery is complete.


Destination changes

Once databases are mounted on the destination Adaptive Server, certain settings are cleared on the mounted database:


System considerations


Performance considerations

When you mount databases onto an Adaptive Server, if you change the dbid of the database you are mounting, all procedures are marked for recompilation in the database. This increases the time it takes to recover the database at the destination, and delays the first execution of the procedure.


Renaming devices

The manifest file contains the device paths known to the source Adaptive Server that created the manifest file. If the destination Adaptive Server accesses the devices with a different path, you can specify the new path to the mount command.

  1. Use the mount command with listonly to display the old path:

    mount database all from "/work2/Mpubs_file" with listonly
    go
    
    [database]
      mydb
    [device]
      "/work2/Devices/pubsdat.dat" = "pubs2dat"
    
  2. If the new path for the device pubs2dat is /work2/Devices/pubsdevice.dat (the devices path in Windows), specify the new device in the mount command:

    mount database all from "/work2/Mpubs_file" using 
       "/work2/datadevices/pubsdevice.dat" = "pubs2dat"
    

    If the logical device names exist in the destination server, they will be renamed using an automatically generated unique name.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

mount requires an SA role.

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

101

mount

mount database

  • Roles – current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – NULL

  • Proxy information – original login name, if a set proxy is in effect

See also

Commands unmount, quiesce database

Documentation Chapter 7, “Database Mount and Unmount,” in System Administration Guide Volume 2