sp_create_removable (Transact-SQL)
Creates a removable media database. Creates three or more files (one for the system catalog tables, one for the transaction log, and one or more for the data tables) and places the database on those files.
Important
|
|---|
|
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. We recommend that you use CREATE DATABASE instead. |
sp_create_removable
[ @dbname = ] 'dbname',
[ @syslogical= ] 'syslogical',
[ @sysphysical = ] 'sysphysical',
[ @syssize = ] syssize,
[ @loglogical = ] 'loglogical',
[ @logphysical = ] 'logphysical',
[ @logsize = ] logsize,
[ @datalogical1 = ] 'datalogical1',
[ @dataphysical1 = ] 'dataphysical1',
[ @datasize1 = ] datasize1 ,
[ @datalogical16 = ] 'datalogical16',
[ @dataphysical16 = ] 'dataphysical16',
[ @datasize16 = ] datasize16 ]
Requires CREATE DATABASE, CREATE ANY DATABASE, or ALTER ANY DATABASE permission.
To maintain control over disk use on an instance of SQL Server, permission to create databases is typically limited to a few login accounts.
Permissions on Data and Log Files
Beginning in SQL Server 2005, whenever certain operations are performed on a database, corresponding permissions are set on its data and log files. The permissions prevent the files from being accidentally tampered with if they reside in a directory that has open permissions.
|
Operation on Database |
Permissions Set on Files |
|---|---|
|
Modified to add a new file |
Created |
|
Backed up |
Attached |
|
Restored |
Detached |
Note
|
|---|
|
SQL Server 2005 Express Edition does not set data and log file permissions. |
The following example creates the database inventory as a removable database.
EXEC sp_create_removable 'inventory', 'invsys', 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\invsys.mdf' , 2, 'invlog', 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\invlog.ldf', 4, 'invdata', 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\invdata.ndf', 10
Important