Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle vs SQL question

Status
Not open for further replies.

ccampbell

Programmer
Joined
Aug 16, 2001
Messages
201
Location
US
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
 

The code isn't likely to work in Oracle. However, you'll probably get a more definitive answer in an Oracle forum. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top