tablespace copy and rename

From: Klaus Baumgart <news_at_dvberatung.com>
Date: Wed, 9 Feb 2005 16:14:29 +0100
Message-ID: <cud9cr$n0k$1_at_newsreader2.netcologne.de>



[Quoted] How can I rename a tablespace without copying the database. Also I have to change the Database User and Schemaname

I would like to do this simelar to the SQL-Server features.

copy Files
cp ALT_NAME NEW_NAME

EXEC sp_attach_db _at_dbname=N'NEW_NAME',
_at_filename1= N'E:\db\NEW_NAME.mdf',
_at_filename2= N'E:\db\NEW_NAME.ldf'

EXEC sp_addlogin 'NEW_NAME', 'NEW_NAME', 'NEW_NAME' GO
USE NEW_NAME
GO
EXEC sp_grantdbaccess 'NEW_NAME', 'NEW_NAME' GO
EXEC sp_addrolemember 'db_owner', 'NEW_NAME' GO
USE NEW_NAME
GO
EXEC sp_revokedbaccess 'NEW_NAME'
GO
EXEC sp_changedbowner 'NEW_NAME'
GO Received on Wed Feb 09 2005 - 16:14:29 CET

Original text of this message