Create a copy of active database using T-SQL.

I have a requirement to create a copy of existing active (currently in use) database through code.
I need to copy all objects which include tables, stored procs, triggers, functions, foreign keys, constraints, primary keys, etc... from source DB to new DB.
Both databases can be in different servers where I have access to both the servers. I also need to copy data for some tables....
It is exactly what copy database wizard is doing... but I want to do it through T-SQL code.....
is it possible?

This doesn't sound like too easy task. I tried to search, but the best I found so far was Freeware SQL Script Generate utility
I do have a blog to generate all stored procedures
How to script all stored procedures in a database
but this is only a small part of the task. Brad Schulz has a blog to generate table creation/insert statements. I don't remember seeing the complete free T-SQL solution for all SQL Server database objects.
Premature optimization is the root of all evil in programming. (c) by Donald Knuth
Naomi Nosonovsky, Sr. Programmer-Analyst
My blog

Similar Messages

  • Issue in creating the standby database from Active database using RMAN

    Hi All,
    I am facing issue in creating the standby database from Active database using RMAN and getting the below issue after i executed the duplicate command.
    Version of Database:11g(11.2.0.1.0)
    Operating System:Linux 5
    Error:
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 12/21/2012 17:26:52
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-04006: error from auxiliary database: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    Primary Database Entries:
    Tnsentry:
    SONYPRD =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.131)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = sonyprd.localdomain)(UR=A)
    SONYPRDSTBY =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.132)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = sonyprdstby)(UR=A)
    Listner Entry:
    SID_LIST_SONYPRD =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtproc)
    (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
    (PROGRAM = extproc)
    (SID_DESC =
    (SID_NAME = SONYPRD)
    (GLOBAL_DBNAME = SONYPRD)
    Auxiliary Details:
    Tns Entry:
    SONYPRD =
    (DESCRIPTION =
    # (ADDRESS = (PROTOCOL = TCP)(HOST = oracle11g.localdomain)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.131)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = sonyprd.localdomain)
    SONYPRDSTBY =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.132)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = sonyprdstby)(UR=A)
    Listener Entry in auxiliary:
    SID_LIST_SONYPRDSTBY =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = SONYPRDSTBY)
    (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
    (SID_NAME = SONYPRDSTBY)
    TNSPING from Primary DB:
    [oracle@oracle11g ~]$ tnsping sonyprdstby
    TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 21-DEC-2012 17:39:28
    Copyright (c) 1997, 2009, Oracle. All rights reserved.
    Used parameter files:
    /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.132)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sonyprdstby)(UR=A)))
    OK (0 msec)
    TNSPING from Auxuliary server
    [oracle@oracle11gstby ~]$ tnsping sonyprd
    TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 21-DEC-2012 17:40:19
    Copyright (c) 1997, 2009, Oracle. All rights reserved.
    Used parameter files:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.131)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sonyprd.localdomain)))
    OK (10 msec)
    Script Used for duplicate:
    run {
    allocate channel prmy1 type disk;
    allocate channel prmy2 type disk;
    allocate channel prmy3 type disk;
    allocate channel prmy4 type disk;
    allocate auxiliary channel stby type disk;
    duplicate target database for standby from active database
    spfile
    parameter_value_convert 'sonyprd','sonyprdstby'
    set db_unique_name='sonyprdstby'
    set db_file_name_convert='/sonyprd/','/sonyprdstby/'
    set log_file_name_convert='/sonyprd/','/sonyprdstby/'
    set control_files='/u01/app/oracle/oradata/control01.ctl'
    set log_archive_max_processes='5'
    set fal_client='sonyprdstby'
    set fal_server='sonyprd'
    set standby_file_management='AUTO'
    set log_archive_config='dg_config=(sonyprd,sonyprdstby)'
    set log_archive_dest_2='service=sonyprd ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=sonyprd'
    Tried the script from both Primary and auxiliary but no luck
    [oracle@oracle11gstby admin]$ rman target sys/welcome@sonyprd auxiliary sys/*****@sonyprdstby
    Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 21 17:26:24 2012
    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    connected to target database: SONYPRD (DBID=3131093559)
    connected to auxiliary database: SONYPRD (not mounted)
    Listener Status from primary:
    [oracle@oracle11g ~]$ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-DEC-2012 18:08:56
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 20-DEC-2012 17:42:17
    Uptime 1 days 0 hr. 26 min. 41 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
    Services Summary...
    Service "sonyprd.localdomain" has 1 instance(s).
    Instance "sonyprd", status READY, has 1 handler(s) for this service...
    Service "sonyprdXDB.localdomain" has 1 instance(s).
    Instance "sonyprd", status READY, has 1 handler(s) for this service...
    The command completed successfully
    Listener Status from Standby when database bring to Nomount state:
    [oracle@oracle11gstby admin]$ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-DEC-2012 18:11:54
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 21-DEC-2012 16:13:47
    Uptime 0 days 1 hr. 58 min. 6 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Listener Log File /u01/app/oracle/diag/tnslsnr/oracle11gstby/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle11gstby)(PORT=1521)))
    Services Summary...
    Service "sonyprdstby" has 1 instance(s).
    Instance "sonyprdstby", status BLOCKED, has 1 handler(s) for this service...
    The command completed successfully
    Please provide any work arounds to proceed further in creating the standby database.
    Thanks,
    Ram.

    Pl do not post duplicates - Issue in configuring Standby Database from Active database in 11g by RMAN

  • How to create a user in UME Database using web dynpro java custom application

    Hi,
    Can you please suggest me how to create a user in UME Database using web dynpro java custom application.
    My Requirement is user can register his/her user id in SAP Portal 7.3 UME database.
    Please suggest me.
    Thanks and Regards,
    Amit

    Hi Amit,
    Generated Documentation (Untitled)
    This is what you're looking for, there's no real cook-book -- though Amey mentioned there might be some material on SDN, perhaps some tutorials.
    You should be looking into com.sap.security.api.IUserFactory, methods newUser(String) which gives you and IUserMaint and commitUser(IUserMaint, IUserAccount) -- IUserAccount can be obtained using com.sap.security.api.IUserAccountFactory, method newUserAccount(String)
    Hope it helps,
    D.

  • How can i create a new and tableless database using database configuration

    How can i create a new and tableless database using database configuration

    How can i create a new and tableless database using database configuration
    Just don't install the sample schemas. See the installation guide
    http://docs.oracle.com/cd/E11882_01/server.112/e10831/installation.htm
    Using the Database Configuration Assistant
    When you install Oracle Database with the Oracle Universal Installer, the sample schemas are installed by default if you select the Basic Installation option. Selecting the sample schemas option installs all five schemas (HR, OE, PM, IX, and SH) in the database. If you choose not to install the sample schemas at that time, you can add them later by following the instructions in section "Manually Installing Sample Schemas".
    Choose a custom install and don't install the sample schemas.
    All other schems/tables installed are REQUIRED by Oracle

  • Is it possible to create a copy of entire database, not the data, but just database structure?

    Greetings community,
    This question is related to EXPRESS edition.
    Let’s say that I have MyDatabase2014 and I’ve been populating it with some data during the year 2014. Before the end of the year, I want to prepare another database named MyDatabase2015, which should be empty, but of course it should have
    all tables, relations, indexes and stored procedures just like MyDatabase2014. The idea is just to change a connection string and to continue using the same app for the same job.
    So in SSMS, I right-clicked the database, choose script database as / create to / new query, but I didn’t get what I wanted. In query window I’ve got just create database statement, and below that few dozen of alter database set ansi this
    or that statements, and set many other things. However, no table creation was scripted. Also, no stored procedures have been created, and about users, and other security objects better not to start to talk about.
    I could have achieved that simply by right-clicking databases node and select new database. So what’s the point of “script database as”?
    Does this work in SQL server editions other than EXPRESS?
    When it comes to express edition, what’s the best practice to get the empty copy of a database?
    Thanks for any help.

    For scripting out the users and their permissions you can use this script
    -- Capture permissions for all users in a DB
    SET NOCOUNT ON
    DECLARE @Database varchar(max)
    SET @Database = '<Db_Name>'-- set the database name here
    IF EXISTS (SELECT * FROM SYS.SYSDATABASES WHERE name = @Database)
    EXEC('USE ' + @Database + ';
    DECLARE @temp table(Extract Varchar(MAX))
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = N'''''''''' + name + '''''''''')IF EXISTS (SELECT *
    FROM sys.database_principals WHERE name = N'''''''''' + name + '''''''''') DROP USER ['' + name + '']''''); ''
    FROM sys.sysusers WHERE islogin = 1 AND hasdbaccess = 1 AND name NOT IN (''dbo'')
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; IF NOT EXISTS
    (SELECT * FROM sys.database_principals WHERE name = N'''''''''' + dp.name + '''''''''')
    CREATE USER ['' + dp.name + ''] FOR LOGIN ['' + sp.name + '']''''); ''
    FROM sys.server_principals sp
    JOIN sys.database_principals dp ON (sp.sid = dp.sid)
    AND dp.name NOT IN (''dbo'')
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; IF NOT EXISTS
    (SELECT * FROM sys.database_principals WHERE name = N'''''''''' + dp.name + '''''''''')
    CREATE USER ['' + dp.name + ''] WITHOUT LOGIN ''''); ''
    FROM sys.database_principals dp left
    JOIN sys.server_principals sp ON (sp.sid = dp.sid)
    where dp.principal_id between 5 and 16383
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; EXEC sp_addrolemember '''''''''' + User_Name([groupuid]) + '''''''''', '''''''''' + User_Name([memberuid]) +
    FROM sys.sysmembers WHERE User_Name([memberuid]) NOT IN (''dbo'')
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; ''
    + CASE [a].[state_desc] WHEN ''GRANT_WITH_GRANT_OPTION'' THEN ''GRANT '' ELSE [a].[state_desc] END
    + '' ''
    + [a].[permission_name] + CASE class WHEN 1 THEN '' ON [''
    + [c].[name]
    + ''].[''
    + Object_Name([a].[major_id]) + ''] '' ELSE '''' END + '' TO [''
    + User_Name([a].[grantee_principal_id])
    + ''] '' + CASE [a].[state_desc] WHEN ''GRANT_WITH_GRANT_OPTION'' THEN '' WITH GRANT OPTION'' ELSE '''' END
    + ''''''); '' COLLATE Latin1_General_CI_AS AS [SQL]
    FROM sys.database_permissions a
    inner join [sys].[all_objects] b
    ON [a].[major_id] = [b].[object_id]
    inner join [sys].[schemas] c
    ON [b].[schema_id] = [c].[schema_id]
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; ''
    + [a].[state_desc]
    + '' ''
    + [a].[permission_name]
    + '' TO [''
    + USER_NAME([a].[grantee_principal_id])
    + ''] '''');''
    from sys.database_permissions a
    where a.class=0
    INSERT INTO @temp (Extract)
    SELECT ''EXEC( ''''USE ' + @Database + '; ''
    + [a].[state_desc]
    + '' ''
    + [a].[permission_name]
    + '' ON SCHEMA ::''
    + '' [''
    + SCHEMA_NAME([a].[major_id]) +
    + ''] TO [''
    + USER_NAME([a].[grantee_principal_id])
    + ''] '''');''
    from sys.database_permissions a
    where a.class=3
    SELECT Extract AS [Extract] FROM @temp
    GO
    ELSE
    SELECT '--NO'
    GO
     

  • HOW TO START MAKING DATABASE USING ORACLE SQL PLUS in 10g?

    how will i create database using sql plus?
    does the code of sql applicable to it..?
    do i have to use the "create db <database name>", use and " create table also,.."
    pls help me..
    thanks

    At dos prompt :
    C:\>set ORACLE_SID=<your SID>
    C:\>sqlplus / as sysdba
    you get connected as sys user. Don't use this connection to create your own objects, create users instead.... but it would be useful to read some documentation, for example Starting SQL*Plus and manuals mentioned there.

  • How to connect database using oracle SQL developer

    Hello
    I am newbie in EBS R12
    I downloaded Oracle SQL Developer
    and create new database conenction
    Connection name: ebs demo db connection
    username:
    password:
    Role: Default
    Connection type: Basic
    Hostname: ebstailin.demo.com
    Port: 1521
    SID: clone
    when i try this there is an error
    Status: Failure-Test failed: lo exception: The Network Adapter could not establish the connection
    no idea about this
    but i used the apps/apps as username and password
    please help
    thanks
    Edited by: cheesewizz on Jul 16, 2010 11:35 PM

    Hello
    Thanks for your reply
    I tried to connect and here is the result: see below
    [oracle@ebstailin 11.1.0]$ sqlplus / as sysdba
    SQL*Plus: Release 11.1.0.7.0 - Production on Sat Jul 17 15:35:31 2010
    Copyright (c) 1982, 2008, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CONNECT apps/apps
    Connected.
    SQL>
    But still cannot connect using ORACLE SQL Developer
    thanks

  • Unable to connect to Oracle Database using Oracle Sql developer 2.1.1.64

    Hi Everyone,
    I am searching for some help regarding my problem with Oracle connectivity. I have installed Oracle 11g release 2 on my Windows XP Professional Laptop. For a few days after installation i could connect to the Oracle database with the SYSTEM account using Oracle SQL developer ( installed on the same Laptop) but now i am unable to do so.It gives me this annoying message:
    An error was encountered performing the required operation  Got a minus one from read call .Vendor code 0
    However i am able to connect using Sql Plus by supplying the username SYSTEM and the corresponding password.
    My TNSNAMES .ora file is as follows:
    ORACLE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORACLE)
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    My Listener.ora file is as follows:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:D:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    (SID_DESC =
    (GLOBAL_DBNAME = Oracle)
    (ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
    (SID_NAME = Oracle)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    ADR_BASE_LISTENER = D:\app
    My Sqlnet.ora file is as follows:
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    I am new to Oracle and so i need someone in this forum who can help me resolve this problem. Also i even tried connecting to the database using Toad 10.5.0.41. It give me the following error:
    ORA 12537 : TNS Connection closed
    Thanks for your patience and help in advance.
    ---Prashant

    Hello Irian and Sue,
    I can connect to the Oracle database using SQL Plus. Now when i TNSPING ORACLE from command line i get the following message :
    Used parameter files:
    D:\app\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost
    *)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACLE)))*
    TNS-12537: TNS:connection closed
    Thanks for your response to my initial post.Do u have any other methods to resolve this?

  • Creating Multiple Users in AS Portal using PL/SQL

    Hi Guys,
    I am very new to Portal and I was wondering if there was a way to add multiple users to Portal using a PL/SQL API?
    I have found an API called wwsec_api which has a function add_portal_users but this doesnt seem to work when I try to add a user.
    Any help is much appreciated
    Thanks
    -Mark

    The users are created in OiD, not in Oracle Portal. Oracle Portal just uses OiD similar to other products.
    The following note on http://support.oracle.com provides information about creation of users in OiD both through PL/SQL and Java :
    Note 277771.1 - How to create a new user in OID using the programmatic interfaces
    For Portal, is is important that the users are created below the user search base configured in your Portal application. This is normally something like cn=Users,dc=<your domain>, e.g. cn=Users,dc=acme,dc=org.
    Hope this helps,
    EJ

  • Search for tablenames in the database using native sql query script

    How do i search for the names of the tables in the database using select statement? I do not know the names of the tables but I know the name of the database and i do not have the sys priviliges.
    thanks
    SS

    SELECT owner, table_name
    FROM all_tables;

  • Creating Standby for RAC ASM database using RMAN

    We are having a Primary Site of 3-Node RAC ASM and we takes daily RMAN backup with the following script
    run
    allocate channel c1 device type disk format 'g:\rmanbackup\%U';
    backup database;
    backup archivelog from time 'trunc(sysdate-1)' until time 'sysdate';
    We have configured 3-Node RAC Cluster in Standby site. We have copied the rman backup folder to one of the Nodes in the Standby site.
    Request your help to restore the RMAN backup. The backup size is around 200GB. We do not know how to use DUPLICATE DUPICATE option in RMAN as if it is restoring from the Primary Location, then transferring 200GB over the network will not be possible.
    We need a solution to restore it directly from the Backup folder available in the DR Server. We are not using catalog.
    OS : Windows IA 64-bit
    RDBMS : Oracle 10.2.0.4
    Storage : ASM
    DB Nodes at Primary Site, Node1, Node2, Node3
    DB instances at primary site : ORCL1, ORCL2, ORCL3
    DB Nodes at Standby Site, Node101, Node102, Node103
    DB instances at Standby site : ORCL1, ORCL2, ORCL3
    DB Name : ORCL on both the sites.

    When you create the standby, you can use catalogued backups, stored somewhere local to your standby servers.
    For that, they need to be copied to the standby server, or taken from production there, and after restoring the standby controlfile on the standby server, use rman to catalogue the backups to be used. Then, you can use DUPLICATE... and it will be reading your local backup files.
    The directory g:\rmanbackup of your rman script is local to standby servers ?
    The docs for this have a lot of details: http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/rcmbackp.htm
    Regards.

  • Unable to create publication item for remote database using db link

    The mobile repository is in instance A.
    I have to access and sync data from a table in remote database instance B.
    I have run the consolidator_rmt.sql script in instance B under schema_B. I have created a private fixed user db link in instance A under schema_A to access schema_B's tables. I then created a synonym test_B for table test_B in schema_B using the DB link.
    While creating publication item for test_B using MDW, the column list for test_B appears blank. Has anyone encountered this problem and what is the solution.
    Thanks for your help.
    Rosa.

    Hello Pruthvi ,
    See these threads
    Uninstalling MaxDB
    Work process Ended.
    Thanks
    Chandran

  • How to create a database using a SQL statement? Please help.

    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.25:1521:mydb","system","12345678");
    but mydb database does not exist.
    I want to make a connection to oracle server without database name.
    How can I do?

    Colleauge, what is the purpose of making a connection to a non-existent database.
    connections are made to the database to retrieve some data or put some data.
    for which the database should exists.
    so please create the mydb database first using Database Configuration Assistant (DBCA) which is much easier as it is GUI based rather than doing it with sql scripts.

  • Issues connecting to sql 2005 database using Oracle sql developer 1.2

    I just installed the sql developer and was trying to use the quick migrate to try a migration from a sql server to oracle..
    I am getting the following error message when i click on the retrieve database after entering the database credentials
    Status : Failure net.sourceforge.jtds.jdbc.driver
    I am getting another error message when i click on the 'test' button
    Status: Failure - Unable to find driver: net.sourceforge.jtds.jdbc.driver
    I downloaded the jtds driver from source forge and i am wondering what I should do to get the sql developer to make successful connections to sql server.
    Any help is appreciated.
    Thanks

    I have the same issue with both version 1.1.3 of the SQL developer and the latest version(1.2.1). I have added the jar file path in tools->preferences->Database->Third Party etc...
    I got the jar file from this download: jtds-1.2.2-src.zip
    I get this error when trying to connect to an sql server:
    oracle.jdeveloper.cm.CMException: Unable to find driver: net.sourceforge.jtds.jdbc.Driver
         at oracle.dbtools.raptor.conntypes.RaptorConnectionWrapper.createConnection(RaptorConnectionWrapper.java:175)
         at oracle.dbtools.raptor.conntypes.RaptorConnectionWrapper.getJdbcConnection(RaptorConnectionWrapper.java:202)
         at oracle.dbtools.raptor.conntypes.RaptorConnectionWrapper.getPresentation(RaptorConnectionWrapper.java:68)
         at oracle.dbtools.raptor.utils.Connections$ConnectionInfo.createConnection(Connections.java:1004)
         at oracle.dbtools.raptor.utils.Connections$ConnectionInfo$ConnectRunnable.doWork(Connections.java:876)
         at oracle.ide.dialogs.ProgressRunnable.run(ProgressRunnable.java:159)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:553)
         at java.lang.Thread.run(Thread.java:595)
    Any help would be appreciated. I like the tool would hate to have to abandon it, it works like a charm on our oracle databases.

  • SMO question: Cannot attach database using captured SQL

    Hi,
    I have the following code
    ServerConnection conn = new ServerConnection(".\\SQLEXPRESS");
    Server svr = new Server(conn);
    svr.ConnectionContext.SqlExecutionModes = SqlExecutionModes.CaptureSql;
    StringCollection sc = new StringCollection();
    sc.Add(Smo.DatabaseFilePath);
    sc.Add(Smo.DatabaseLogPath);
    svr.AttachDatabase(Smo.DatabaseFilePath.ToUpper(), sc, AttachOptions.None);
    int[] results = svr.ConnectionContext.ExecuteNonQuery(svr.ConnectionContext.CapturedSql.Text);
    svr = null;
    conn.Disconnect();
    conn = null;
    It works fine if I call svr.AttachDatabase(Smo.DatabaseFilePath.ToUpper(), sc, AttachOptions.None) directly without going through the captured SQL.
    Any ideas why?
    Thanks in advance.

    Hi superflyguy71,
    Please , could you tell what you mean with these both code lines ?
    sc.Add(Smo.DatabaseFilePath);
    sc.Add(Smo.DatabaseLogPath);
    I don't know any class or property named DatabaseFilePath or DatabaseLogPath in the namespace Microsoft.SqlServer.Management.Smo in any version of Smo since its creation ( 2005 )
    Compare
    http://msdn.microsoft.com/en-US/library/ms210175(v=sql.90).aspx and
    http://msdn.microsoft.com/en-US/library/ms210175(v=sql.120).aspx
    I am not sure that this code could even be compiled with errors.
    Have a nice day
    PS : I would suggest you to have a look at this old thread ( with no use of AttachOptions )
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/b8e80512-c3be-4048-b633-f9b1dc36c8b4/c-smo-attach-sql-database-fails-console-application?forum=sqlsmoanddmo
    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

Maybe you are looking for