Download [Problem Type : Other] [Item : Web+Center 7.0] Last Modified Date

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Microsoft Access wikipedia , lookup

IMDb wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Team Foundation Server wikipedia , lookup

Oracle Database wikipedia , lookup

SQL wikipedia , lookup

Functional Database Model wikipedia , lookup

Btrieve wikipedia , lookup

Ingres (database) wikipedia , lookup

PL/SQL wikipedia , lookup

Database wikipedia , lookup

Concurrency control wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Relational model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Versant Object Database wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
Web+Center
July 18, 2011
Upgrading to a newer version of SqlServer and migrating data at the same time
In this example, we are upgrading a Web Center 5.0 database to 7.0 and moving it from SqlServer 2000
to SqlServer 2008.
Step 1. Move a copy of the webcenter50 database over to the new server and name it webcenter70.
Option 1: using the Copy Wizard
If you are able to connect to both sqlservers on a single instance of SqlServer Management Studio you
may be able to do this rather than having to attach/detach, which necessitates shutting people out of
the database. This is not an option if you’re running Sql Express edition (the free version). If you have a
copy of WebCenter70 that you set up for test, either rename it to something else (right click) or delete
it.
Select the webcenter50 database. Right click, select tasks and select ‘COPY” (this is not the same as
‘copy subscription database’. You might not have this option. When the copy wizard starts, select the
‘use Sql Management Option’ rather than the ‘detach/attach’ radiobutton. Apparently the Sql
Management option leaves webcenter50 up and running; detach/attach does not. Select the new
server (if you have the option to rename the database, rename it to WebCenter70). Select the ‘run
immediately’ option. This takes a while.
1
If you are successful, you’ll probably need to set up the wc70 login again to point to the webcenter70
database (it was probably reset to ‘master’) and also look for any of the security things that got changed.
In order to do a copy (if this is even an option) you’ll have to have SqlAgent running (it will tell you if it
isn’t).
Option 2: Detach/attach.
Find the .mdf and .ldf files which correspond to your current database (they are probably somewhere
like C:\program files\microsoft SQL Server\MSSQL\data but depends on how you installed SqlServer).
You could probably also figure this out by right clicking on the database, select ‘tasks’, ‘backup’, or right
click the database, select ‘properties’, select the ‘files’ tab) and see where the files are going) or just
browser around on the server. (FYI - 2005 is considered version 9 of SqlServer, 2008 is version 10.) You
can do a ‘select @@Version’ in a query window with the database selected and find out the version if
you want or need to. My 2008 files were in ‘c:\program files\microsoft sql
server\mssql10.servername\mssql\data’.
Unfortunately you can’t do a detach/attach unless you take the database down for a little bit since there
appears to be no way of copying the .mdf and ldf files if they are being used, because of sharing
violations.
1. Get rid of (delete) the current webcenter70 database that you created (if you did a test run first).
2. If this is the non-test, final database migration, you might want to shut people out of database or
the application first, either by changing the odbc connection string for webcenter 50 to something that
doesn’t work (fool proof but rather clumsy) or however else you bring the system down.
2
3. Set the webcenter50 database to single user mode by right clicking on the database, selecting
properties, selecting options, near the bottom set ‘restrict access’ to single user. If this doesn’t work,
open a query window and type ‘ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK
IMMEDIATE’ (substitute the database name in the <dbname> field)’. NOTE: if this database is replicated,
please talk to your DBA first because you cannot detach a database that is being replicated.
4. Back up the database.
5. Detach current database. Then right click on webcenter50, select detach. (alternately, you can go
into a query window with ‘master’ selected as the database and run the following:
EXEC sp_detach_db @dbname = 'webcenter50'; (FYI - this apparently removes the database from the
master database). You may get the options of drop connections (which removes it from the list of
databases in sqlserver management studio (Probably NO) and update statistics (YES). The detaching
creates makes .mdf and .ldf files current.
Using the detach database wizard:
6. Quickly COPY the .mdf and .ldf files to the appropriate place on the new server or anywhere that’s
quick for now if you’re just in test mode and want the old database up as soon as possible.
3
7. If this is just a test run and you want your old database back up for users, quickly re-attach the OLD
database (you’ll need to be in a query window with the master database selected) and you might want
to have this command ready to go with the proper locations of these (the original) files. This should
make the webcenter50 database functional again although you might want to check the login for wc50
and make sure the default database still says webcenter50. If this is your final migration, you do not
have to do this step. Rright click on the server name in Management Studio and select ‘tasks’ -> ‘attach’
and navigate to the files you just detached; Alternately you can open a query window with the master
database selected and type in the following (the first way seems a lot easier):
exec sp_attach_db @dbname=’webcenter50’,
@filename1='C:\Program Files\Microsoft SQL Server\MSSQL.4\MSSQL\Data\webcenter50.mdf',
@filename2='C:\Program Files\Microsoft SQL Server\MSSQL.4\MSSQL\Data\webcenter50_log.ldf'
(Obviously substitute the correct path and filenames). You’ll also want to make sure the database is in
multi-user mode.
Phew. Old database back up again.
Using the ‘attach database’ wizard.
Then, select ‘add’ in the top half of the right screen and navigate to where the .mdf/.ldf files are:
4
5
8. Copy files to the new server. If you didn’t do this in a previous step, copy the mdf and ldf files to the
new server to the location where the 2008 files normally backup. My files were in ‘c:\program files\microsoft
sqlserver\mssql10.servername\mssql\data’. Rename these files to version 70 (from 50) so you don’t get confused
at some point in the future.
9. Attach new database. Then on SqlServer Management Studio pointing to the NEW server, either right click
on the server connection and select ‘attach’ (might be under ‘tasks’) or run the following attach command:
exec sp_attach_db @dbname=’webcenter70’,
@filename1= ‘c:\program files\microsoft sql server\mssql10.servername\mssql\data\webcenter70.mdf',
@filename2= ‘c:\program files\microsoft sql server\mssql10.servername\mssql\data\webcenter70_log.ldf'
(obviously change the file name/locations)
In SQL Server Management Studio, a newly attached database is not immediately visible in Object
Explorer. To view the database, click the Object Explorer window, and select View > Refresh. When the
Databases node is expanded, the newly attached database now appears in the list of databases.
10. Then run dbcc updatestatistics (0) in the query window for webcenter50 if you didn’t select this option when
you detached. In earlier versions of SQL Server, the values for the table and index row counts and page
counts can become incorrect. Therefore, databases that were created on versions prior to SQL Server
2005 may contain incorrect counts. After you upgrade a database, we recommend that you run DBCC
UPDATEUSAGE to correct any invalid counts. This DBCC statement corrects the rows, used pages,
reserved pages, leaf pages and data page counts for each partition in a table or index.
11. You can do a ‘select @@Version’ in the query window to make sure it says it’s 10 (assuming you’re migrating
to Sql 2008.
12. Rename the database webcenter70 (right click) if you didn’t get a chance to earlier.
STEP 2:
1.
Run the upgrade script for upgrading webcenter50 to 60 (UpgradeWebCenter50to60SQL.sql).
2.
Run the upgrade script for upgrading webcenter60 to 70 (UpgradeWebCenter60to70SQL.sql).
3. Set up the logins (if need be) and permissions/security as per installation instructions (or at least check them –
I think if you had set them up to test and then deleted the database, the permissions are probably not still valid
although the login probably exists on the server). Also make sure the default database for the wc70 user is set to the
webcenter70 database. You’ll need to check both the Logins (Server security section) and Users (database security
section). Make sure the database is in multiuser mode.
4. Make sure your odbc connection for webcenter70_db is good. Run the installation tests
(tech70/installtest.html).
5. When you’re all set up, make sure you create a backup job for the new database!
6
NOTE: I suggest doing this twice – once as a trial run and once for the real thing. Do complete backup before the
real thing.
Note: To copy files over the network to a disk on a remote computer using the universal naming convention (UNC)
name of the remote location. A UNC name takes the form \\Servername\Sharename\Path\Filename. As for
writing files to the local hard disk, the user account used by SQL Server must have been granted the permissions
required for reading or writing to a file on the remote disk.
7