Exercise 10: Detach the buildings geodatabase from the database server
This topic applies to ArcEditor and ArcInfo only.
To move a geodatabase from one database server to another, you can detach it from the database server, copy the database files (the .mdf file if you are using SQL Server 2008 Express or the .mdf and full-text catalog folder if you are using SQL Server 2005 Express) over the network or onto transfer media, such as a thumb drive, then paste it onto the destination server. Once there, you can attach the geodatabase to the database server.
Some examples of situations when you might do this include the following:
- If you use the data from the geodatabase on a database server on your desktop computer, then want to take the geodatabase into the field to collect data, you could detach the database server from the server on your desktop computer, transfer the database files to your laptop, and attach the geodatabase to the database server on your laptop.
- When ownership of a geodatabase is transferred, such as when an employee leaves the company, you could move the geodatabase from the database server on the former employee's computer, copy it to the new owner's computer, and attach it to a database server there.
- When you hire consultants to collect or create datasets for you, you can request they deliver the data in a geodatabase in SQL Server Express. Then, when they send you the files, you can attach them to your database server.
Detaching a geodatabase from the database server does not delete the database files, but it removes references to the database from the SQL Server Express instance.
When sharing geodatabases across database servers, be aware of who owns the data and has permission to work with it. This is important because ArcSDE geodatabases in SQL Server Express use Windows-authenticated logins. If you are using local Windows logins, when you transfer the geodatabase to a new computer, those users won't exist on the new computer. Similarly, if you use network logins, then transfer the geodatabase to a database server outside the network, those logins will not exist.
How you deal with this depends on your workflow. If you know ahead of time that you are going to be moving the geodatabase around a lot, you might want to create all the data in the geodatabase while logged in as the dbo user. The dbo user and schema are always present in database servers; therefore, even if you move the geodatabase to a database server on a different network, you can still log in as dbo, add new users to the database server, and grant them permissions to the data.
If you hadn't anticipated having to move the geodatabase and the data owners don't exist on the destination database server, you could still log in as the dbo user and perform one of the following set of steps:
- Add new users to the destination database server.
- Grant read/write or higher-level access to the geodatabase to the users to whom you want to transfer ownership of the data. Granting these permissions at the geodatabase level allows the users to access all the data in the geodatabase.
- Ask the users to log in to the geodatabase and either copy the data to a new geodatabase to which they also have read/write access or copy and paste the data in place, giving the pasted datasets and columns new names.
- Create a second geodatabase on the destination database server.
- Copy the data to the new geodatabase. Note:
Dbo is now the owner of all the datasets in the second geodatabase.
- Add new users to the destination database server.
- Grant these users access to the datasets.
Detaching the buildings geodatabase
Suppose you want to move the buildings geodatabase (named either buildings05 or buildings08, depending on the version of SQL Server Express you are using) from the database server on your personal computer (PC) to a database server on your laptop so you can take it into the field and collect traffic data there. You could use geodatabase replication to replicate the data to a geodatabase in a database server on your laptop, or you could detach the geodatabase from the database server on your PC, move it to your laptop's hard drive, and attach it to the database server there.
To detach the buildings geodatabase from the database server, do the following:
- Log in to the computer with your own Windows login.
- Start ArcCatalog by clicking Start > All Programs > ArcGIS > ArcCatalog 10.
- Expand the Database Servers node in the Catalog tree and connect to the database server. However, do not connect to the buildings geodatabase.
Right-click the buildings geodatabase on the Catalog Contents tab, point to Administration, then click Detach.
It is important that you right-click the geodatabase on the Contents tab, not in the Catalog tree. If you right-click the geodatabase in the Catalog tree, you connect to it. You cannot detach a geodatabase that has any active connections to it; therefore, if you are connected when you try to detach, the detach operation will fail.
- When the Confirm Detach dialog box appears, take note of the location of the database file; you will need to know where it is so you can copy it to another location or if you plan to reattach the database in the future.
- Click Yes on the Confirm Detach dialog box.
You could now open Windows Explorer, navigate to the location of the buildings05.mdf file and buildings05_CAT folder (SQL Server 2005 Express) or buildings08.mdf file (SQL Server 2008 Express), then copy them to media or over the network to transfer them to another computer.
For instructions on attaching the geodatabase, see Exercise 3: Attach, create a backup of, and upgrade a geodatabase or Attaching a geodatabase to a database server.