SQL Server - Alternative Methods
If the 'Create Archive Scripts' action cannot be used, the following alternative ways of archive creation exist for SQL Server:
Option 1 - Generate the DDL using SQL Server Management Studio
- In the 'Object Explorer' of SQL Server Management Studio, right-click the schema and call command 'Generate Scripts' from the 'Tasks' submenu.
- In the 'Set scripting options' dialog, click 'Advanced'. The 'Advanced Scripting Options' dialog opens.
- In the 'Advanced Scripting Options' dialog, make sure that:
- Script Foreign Keys is set to 'False'
- Script Indexes is set to 'False'
- Script Triggers is set to 'False'
- Generate ("Publish") the script
- Open the generated DDL file in SQL Server Management Studio and
Option A - to create the archive as a new database:
A1. Replace the name of the database (in the whole script) with the same name but ending with _A (e.g. VM46B190_A)
A2. Execute the script
Option B - to create the archive as a new schema:
B1. Create a new file group ARCHIVE and a new data file associated with this file group
B2. Create a new schema (e.g. dbo_a)
B3. In the generated file, replace schema [dbo] with [dbo_a] (also dbo. with dbo_a., which is often used in view definitions) and filegroup [PRIMARY] with [ARCHIVE]
B4. execute the script
Option 2 - Generate the DDL using a Valuemation Console template
- Using the following Console template, generate the DDL needed to create the archive schema:
-- $TABLESANDVIEWS$
$TABLE.sql.archive$;
- Open SQL Server Management Studio
- Create a new empty database with the same name as the main database but ending with _A (e.g. VM46B190_A)
- Open an SQL worksheet and paste the content of the generated DDL into it
- Replace $QUALIFIER with the schema name (the same as for the normal database- e.g. dbo).
- Execute the script
Important: remember to commit the changes after the script is executed (F11)!
|