Showing posts with label disk. Show all posts
Showing posts with label disk. Show all posts

Thursday, March 22, 2012

changing the data files to another disk partition

Hi,

I have a sql server 7 running on a machine with two disk partitions (D: and E:).

The data files xxx.mdf and xxx.ldf are stored in D:, which has very few space available. I want to copy these files to E: but I get an error saying that it is not possible to change the source file of a database. Is it possible to do it or do i have to create another data file in E: and keep the old one in D:?

Thanks in advance,

browsersp_detach_db + sp_attach_db ... with (...)|||detach the database ... copy to new location ... then attach

or

backup the database ... restore ... sp_renamedb|||thanks ms_sql_dba and Enigma, it worked properly!sql

Friday, February 24, 2012

Changing Logical Names

This is something I've always wondered. I know how to change the actual nam
e
of the mdf and ldf files on disk. You just detach, change the names on the
disk and reattach with the new names. But how do you change the logical
names of the mdf and ldf files, i.e. the names that you use when you do a
restore with move'CLM,
After restoring the database using "move" option, you can use "alter
database" to change the logical name of the files.
alter database northwind
modify file (name=northwind, newname=northwind_data)
go
exec sp_helpdb northwind
go
AMB
"CLM" wrote:

> This is something I've always wondered. I know how to change the actual n
ame
> of the mdf and ldf files on disk. You just detach, change the names on th
e
> disk and reattach with the new names. But how do you change the logical
> names of the mdf and ldf files, i.e. the names that you use when you do a
> restore with move'|||CLM,
After restoring the database using "move" option, you can use "alter
database" to change the logical name of the files.
alter database northwind
modify file (name=northwind, newname=northwind_data)
go
exec sp_helpdb northwind
go
AMB
"CLM" wrote:

> This is something I've always wondered. I know how to change the actual n
ame
> of the mdf and ldf files on disk. You just detach, change the names on th
e
> disk and reattach with the new names. But how do you change the logical
> names of the mdf and ldf files, i.e. the names that you use when you do a
> restore with move'

Changing Logical Names

This is something I've always wondered. I know how to change the actual name
of the mdf and ldf files on disk. You just detach, change the names on the
disk and reattach with the new names. But how do you change the logical
names of the mdf and ldf files, i.e. the names that you use when you do a
restore with move'CLM,
After restoring the database using "move" option, you can use "alter
database" to change the logical name of the files.
alter database northwind
modify file (name=northwind, newname=northwind_data)
go
exec sp_helpdb northwind
go
AMB
"CLM" wrote:
> This is something I've always wondered. I know how to change the actual name
> of the mdf and ldf files on disk. You just detach, change the names on the
> disk and reattach with the new names. But how do you change the logical
> names of the mdf and ldf files, i.e. the names that you use when you do a
> restore with move'

changing logical file names

Using SS2000 SP4. I want to create a new test database from an existing
database backup. This is the sql that I use:
RESTORE DATABASE SMC_Test
FROM disk = '\\Depts\Technology\SQLServer\Backups\Co
lu\SMS\smc_936.bak'
WITH RECOVERY,
MOVE 'SMC_Data' TO 'S:\SQL\Data\SMCLMS_Test_Data.mdf',
MOVE 'SMC_Log' TO 'L:\SQL\Logs\SMCLMS_Test_Log.ldf'
Is there a way to change the logical file names at the same time? In another
post I saw this sql:
USE master
go
ALTER DATABASE XXX MODIFY FILE
( NAME='XX_old Name',NEWNAME='XX_New Name' )
go
Do I have to run that after I restore the database or is there another way?
Thanks,
--
Dan D.You have to do it after the restore.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:1A8C3983-25E6-4762-A6D6-3C78BCC89114@.microsoft.com...
> Using SS2000 SP4. I want to create a new test database from an existing
> database backup. This is the sql that I use:
> RESTORE DATABASE SMC_Test
> FROM disk = '\\Depts\Technology\SQLServer\Backups\Co
lu\SMS\smc_936.bak'
> WITH RECOVERY,
> MOVE 'SMC_Data' TO 'S:\SQL\Data\SMCLMS_Test_Data.mdf',
> MOVE 'SMC_Log' TO 'L:\SQL\Logs\SMCLMS_Test_Log.ldf'
> Is there a way to change the logical file names at the same time? In anoth
er
> post I saw this sql:
> USE master
> go
> ALTER DATABASE XXX MODIFY FILE
> ( NAME='XX_old Name',NEWNAME='XX_New Name' )
> go
> Do I have to run that after I restore the database or is there another way
?
> Thanks,
> --
> Dan D.|||Thanks.
--
Dan D.
"Tibor Karaszi" wrote:

> You have to do it after the restore.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:1A8C3983-25E6-4762-A6D6-3C78BCC89114@.microsoft.com...
>
>