How to Create a New Project by Copying (Microsoft SQL Server)
How to Create a New Project by Copying (Microsoft SQL Server)
Occasionally, you will want to create one project from another. Copying an existing project is useful for creating databases for remote offices that have the same validating codes as the database in the home office, or for creating projects for performing "what-if" analyses.
- First detach the project. Start the Microsoft SQL Server Query Analyzer. If you have not changed the default database administrator account information, complete the Administrator option with "sa" and leave the Password option blank.
- Detach the project from the server. If your original project is named "myproject", you would use a statement like the following:
EXEC sp_detach_db @dbname = "myproject"
GO
-
Use the Windows Explorer New Folder command to
create a new project folder, such as "
archibus\projects\newproject\data
". - Copy the original database file and log file (the .mdf and .ldf files) and all of the project drawing files (the .Dwg files) to this new project folder.
-
One way to do this is to use the Windows Explorer Copy
command to select all of the files in the
archibus\projects\newproject\data
folder, find the new project folder, and then use the Paste command to paste the files into the new project folder,archibus\projects\newproject\data
. - If you have the database files on a database server computer and your project files on a file server computer, you will need to copy the files in two steps.
- First, copy the database file (.mdf file) to a new folder on the database server computer. You do not need to copy the log file (.ldf file). If a database is successfully detached, SQL Server re-creates the log file when that database is reattached.
- Next, copy the files in the project folder (e.g., the .dwg files) to a new project folder on the file server computer.
-
Rename the project database file to reflect the
new name of the project. In the example above, you would rename
myproject.mdf
tonewproject.mdf
. - Now that the files are copied, re-attach the original database to the server. In the SQL Server Query Analyzer, issue a statement like the following:
EXEC sp_attach_single_file_db @dbname = "MyProject"@physname = "C:\public\users\archibus\projects\myproject\data\myproject.mdf"
-
Make a new entry in the project list (
afm-projects.xml
) for this project. Use the same parameters as when using the command to create a new project. See Configure project preferences and Adding a New Project . - Run the script to map your database accounts and grant permissions. For more details see: Starting Microsoft SQL Server Projects