saveas(backup restore) question!

  • BACKUP DATABASE abw_SWBS_200k 

    TO DISK = 'C:\Program Files\ShipWgt\AsBuilt\Temp.BAK'

    RESTORE FILELISTONLY  FROM DISK = 'C:\Program Files\ShipWgt\AsBuilt\Temp.BAK' 

    RESTORE DATABASE abw_TEMP_03  FROM DISK = 'C:\Program Files\ShipWgt\AsBuilt\Temp.BAK'  WITH  REPLACE, MOVE 'abw_SWBS_200k' TO 'c:\testdb01.mdf',  MOVE 'abw_SWBS_200k_log' TO 'c:\testdb01.ldf'

     

     I tried this - and it work nice, but.... In this T_SQL - I set the filename to c:\Testdb01.mdf and ldf. How can I avoid this? Trying to have a save as in my application.

    Are there anywhere in the registry telling me where the "data" path of SQL Server is, or if anyone have another suggestion to save as, I would be delighted to hear from you!


    -Lars

    Please only reply to this newsgroup. All mails would be bounced back.

  • For SQL2K try

    declare @rc int,@dir nvarchar(4000)

    exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @dir output, 'no_output'

    select @dir

    declare @rc int,@dir nvarchar(4000)

    exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultLog', @dir output, 'no_output'

    select @dir

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Another thing that came up!

    Runniing this on a server - LTG_ARBST:

    BACKUP DATABASE abw_SWBS_200k  TO DISK = '\\LTG_ARBST\Felles\Data\Temp_LTG.BAK' RESTORE FILELISTONLY  FROM DISK = '\\LTG_ARBST\Felles\Data\Temp_LTG.BAK'  RESTORE DATABASE abw_SWBS_200k_a  FROM DISK = '\\LTG_ARBST\Felles\Data\Temp_LTG.BAK'  WITH replace, MOVE 'abw_SWBS_200k' TO '\\LTG_ARBST\Felles\Data\abw_SWBS_200k_a.mdf',  MOVE 'abw_SWBS_200k_log' TO '\\LTG_ARBST\Felles\Data\abw_SWBS_200k_a_log.ldf'

    If this save as  is runned on another computer. How can the SQL server know

    where the file is? I then have to map it up to the SQL server - and I then

    receive this error!

     

     

    Server: Msg 5110, Level 16, State 2, Line 1

    File '\\LTG_ARBST\Felles\Data\abw_SWBS_200k_a.mdf' is on a network device not supported for database files.

    Server: Msg 3156, Level 16, State 1, Line 1

    File 'abw_SWBS_200k' cannot be restored to '\\LTG_ARBST\Felles\Data\abw_SWBS_200k_a.mdf'. Use WITH MOVE to identify a valid location for the file.

    Server: Msg 5110, Level 16, State 1, Line 1

    File '\\LTG_ARBST\Felles\Data\abw_SWBS_200k_a_log.ldf' is on a network device not supported for database files.

    Server: Msg 3156, Level 16, State 1, Line 1

    File 'abw_SWBS_200k_log' cannot be restored to '\\LTG_ARBST\Felles\Data\abw_SWBS_200k_a_log.ldf'. Use WITH MOVE to identify a valid location for the file.

    Server: Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.


    -Lars

    Please only reply to this newsgroup. All mails would be bounced back.

  • look here

    http://support.microsoft.com/default.aspx?scid=kb;en-us;304261

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • I think I read of SQL-NS or anything lookalike to those things inside EM. I

    might use that then!

    --


    -Lars

    Please only reply to this newsgroup. All mails would be bounced back.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply