I have the following query written:
-- ========================================
-- Used to delete the old Database
-- ========================================
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'TEST')
DROP DATABASE TEST
GO
-- ===================================================================
-- This section is used to find the directory where the *.mdf and
-- *.ldf files are kept, and then create the database putting those
-- files in the appropriate directory.
-- ===================================================================
Declare @dir varchar(128), @sql nvarchar(2000)
Select @dir=rtrim(filename)
From master.dbo.sysdatabases--From master.dbo.sysfiles
Where name='model' --Where name='master'
Select @dir
Set @dir=left(@dir, datalength(@dir)-charindex('\',reverse(@dir)))
Select @dir
Set @sql='
CREATE DATABASE TEST
ON
( NAME = TEST_dat,
FILENAME = ''' + @dir + '\test.mdf'',
SIZE = 200MB,
FILEGROWTH = 10% )
LOG ON
( NAME = TEST_log,
FILENAME = ''' + @dir + '\test.ldf'',
SIZE = 20MB,
FILEGROWTH = 10% )'
exec (@sql)
-- =====================
-- Restore Database
-- =====================
-- First determine the number and names of the files in the backup.
RESTORE FILELISTONLY
FROM DISK = N'c:\test.dbk'
-- Restore the files for new Db.
RESTORE DATABASE TEST
FROM DISK = N'c:\test.dbk'
WITH REPLACE
GO
My question is, will this query work for ORACLE databases as well? I would like to run this query to install and restore a .dbk(database device backup) file on an oracle machine that exists on a network drive. Is it possible witht his query? If not, what modifications need to be made? Thanks
-- ========================================
-- Used to delete the old Database
-- ========================================
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'TEST')
DROP DATABASE TEST
GO
-- ===================================================================
-- This section is used to find the directory where the *.mdf and
-- *.ldf files are kept, and then create the database putting those
-- files in the appropriate directory.
-- ===================================================================
Declare @dir varchar(128), @sql nvarchar(2000)
Select @dir=rtrim(filename)
From master.dbo.sysdatabases--From master.dbo.sysfiles
Where name='model' --Where name='master'
Select @dir
Set @dir=left(@dir, datalength(@dir)-charindex('\',reverse(@dir)))
Select @dir
Set @sql='
CREATE DATABASE TEST
ON
( NAME = TEST_dat,
FILENAME = ''' + @dir + '\test.mdf'',
SIZE = 200MB,
FILEGROWTH = 10% )
LOG ON
( NAME = TEST_log,
FILENAME = ''' + @dir + '\test.ldf'',
SIZE = 20MB,
FILEGROWTH = 10% )'
exec (@sql)
-- =====================
-- Restore Database
-- =====================
-- First determine the number and names of the files in the backup.
RESTORE FILELISTONLY
FROM DISK = N'c:\test.dbk'
-- Restore the files for new Db.
RESTORE DATABASE TEST
FROM DISK = N'c:\test.dbk'
WITH REPLACE
GO
My question is, will this query work for ORACLE databases as well? I would like to run this query to install and restore a .dbk(database device backup) file on an oracle machine that exists on a network drive. Is it possible witht his query? If not, what modifications need to be made? Thanks