Wikis - Page

How can a complete database be unloaded and loaded on SQL Server DB

1 Likes

1.Unload

 

1) create a shared folder, e.g. C:\data_SM964_OOB

 

2) open a command window (cmd) and go to folder e.g. C:\Program Files (x86)\Microfocus\Service Manager 9.64\Server\RUN (default)

 

3) Stop the service "Service Manager 9.64 Server" or quiesce the system

 

4) run command    

 

       sm -system_unload -system_directory:<path>

 

for our example this is: 

 

       sm -system_unload -system_directory:C:\data_SM964_OOB 

 

2.Load

 

1) stop SM application server

2) drop all tables of SMDEMO database (OOB database)

 

--/Step 1**********Remove foreign key constraints for all tables**************************/

 

 DECLARE c1 cursor for

  select 'alter table ['+ object_name(parent_obj) + '] drop constraint ['+name+']; '

  from sysobjects

  where xtype = 'F'

  open c1

  declare @c1 varchar(8000)

  fetch next from c1 into @c1

 while(@@fetch_status=0)

 begin

 exec(@c1)

 fetch next from c1 into @c1

end

 close c1

 deallocate c1

 

--/Step 2 **********DELETE ALL TABLES**************************/

 

 ---use 命名空间21 GO

 declare @sql varchar(8000)

 while (select count(*) from sysobjects where type='U')>0

 begin

SELECT @sql='drop table ' + name

 FROM sysobjects

 WHERE (type = 'U')

ORDER BY 'drop table ' + name

exec(@sql)

End

 

3) open a command window (cmd) and go to folder e.g. C:\Program Files (x86)\Microfocus\Service Manager 9.64\Server\RUN (default)

 

4) run command   

 

       sm -system_load -system_directory:<path> -sqldictionary:<dbtype>

 

       -sqldictionary:<dbtype> : if this parameter is missing, the sm.ini in the RUN directory is used.

Tags:

Labels:

Knowledge
Comment List
Related
Recommended