SQL Server Dababase data split

Dear All,
I have a database with 235 GB Data. Now currently database is shared by two countries transnational data. Now I got the requirement to separate the data of two countries as two individual databases.
Would you please suggest the best way to do this.
I have couple of questions here:
1) It has 300 tables and how can I generate all the constrains create script?
2)How can I delete the relationship of all tables?
3) after splitting the databases how can I make sure the integrity and How can I make sure to get the as is of same production database?
Thank you in advance
Srikanth

Before you arrived at these questions, you probably went through a mental process that made you ask these questions. Unfortunately, since we don't know that mental process, we don't really know what you have in mind.
My general take on this, is that I use BACKUP/RESTORE and make a copy of the database, and then run a bunch of DELETE operations in both databases to get rid of the unwanted data. My first approach would be do this in reference order, so that I don't
have to drop the constraints.
But, admittedly, this can be difficult to achieve. In that case I would run:
SELECT 'ALTER TABLE ' + quotename(s.nname) + '.' + quotename(o.name) +
       ' NOCHECK CONSTRAINT ALL '
FROM   sys.objects o
JOIN   sys.schemas s ON s.schema_id = o.schema_id
WHERE  o.type = 'U'
Copy the result and run it. This disables all constraints. (foreign keys
and CHECK constraints to be precise.)
And then the same operation to disable triggers.
When the deletion operation is completed, I would run
DBCC CHECKCONSTRAINTS WITH ALL_CONSTRAINTS
to verify that that there are no constraint violations.
Finally, reenable all triggers and constraints. When doing the latter, it is important to run it as:
SELECT 'ALTER TABLE ' + quotename(s.nname) + '.' + quotename(o.name) +
       ' WITH CHECK CHECK CONSTRAINT ALL '
FROM   sys.objects o
JOIN   sys.schemas s ON s.schema_id = o.schema_id
WHERE  o.type = 'U'
If you don't add WITH CHECK, SQL Server will not check the constraints when enabling them. This will leave them as not trusted, which means that the optimizer cannot use them.
Strictly speaking, you can skip DBCC CHECKCONSTRAINTS, since reenabling the constraints also checks that they are valid. However, DBCC CHECKCONSTRAINTS gives you better error diagnostics.
One challenge that I have not touch is integrity maintained by the triggers. This is something you will have to figure out.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Connect to MS SQL Server 2000 data warehouse

    Hi,
    I use a MS SQL Server 2000 database for my web application where I use JSP. I suppose to create data warehouse using MS SQL Server's Data Transformation Service. But I don't know it's possible to connect to a MS SQL Server's data warehouse using JSP. So I want to know is it possible to connect to data warehouse using JSP and if it is how to do it? Thank you.

    You can certainly connect to M$ SQL Server using the JDBC driver:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en
    Connecting to a data warehouse is no different from any relational database. (My understanding is that a data warehouse usually means a star schema implemented in a relational database.) This will connect you.
    If you're not familiar with JDBC, you might need the tutorial:
    http://java.sun.com/docs/books/tutorial/jdbc/

  • Writing a stored procedure to import SQL Server table data into a Oracle table

    Hello,
    As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
    I started to write it based on what I have but I know this is not correct :/
    # Here is the select statement for the data source in SQL Server...
    SELECT COMPANY
    ,CUSTOMER
    ,TRANS_TYPE
    ,INVOICE
    ,TRANS_DATE
    ,STATUS
    ,TRAN_AMT
    ,CREDIT_AMT
    ,APPLD_AMT
    ,ADJ_AMT
    ,TRANS_USER1
    ,PROCESS_LEVEL
    ,DESCRIPTION
    ,DUE_DATE
    ,OUR_DATE
    ,OUR_TIME
    ,PROCESS_FLAG
    ,ERROR_DESCRIPTION
      FROM data_source_table_name
    #It loads data into the table in Oracle....   
    Insert into oracle_destination_table_name (
    COMPANY,
    CUSTOMER,
    TRANS_TYPE,
    INVOICE,
    TRANS_DATE,
    STATUS,
    TRANS_AMT,
    CREDIT_AMT,
    APPLD_AMT,
    ADJ_AMT,
    TRANS_USER1,
    PROCESS_LEVEL,
    DESCRIPTION,
    DUE_DATE,
    OUR_DATE,
    OUR_TIME,
    PROCESS_FLAG,
    ERROR_DESCRIPTION)
    END;

    CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
    OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
    DATABASE LINK
    Personally, I'd just load the data over a database link:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_table@mssql_db_link
    As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
    (most likely you'll need to use an ODBC driver)
    EXTERNAL TABLE
    If the data from MS-SQL is in a CSV file, just use and external table.
    same concept:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_external_table
    MK

  • How to migrate MS SQL Server OLAP data to Oracle 10g OLAP

    Hi,
    Anyone has any idea on whether migration workbench can migrate my MS SQL Server OLAP data to Oracle 10g (with OLAP option) ?
    Best Regards,
    Ian Ho

    Ian,
    What exactly do you mean by SQL*Server OLAP ? Is it just a 'normal' SQL*Server database which is used for an OLAP application ?
    The migration workbench migrates schema objects, triggers, and stored procedures and is not concerned with the application that uses those objects.
    And the same with the Oracle OLAP database. Once the data etc has been moved into the database you can then use it for whichever application you want.
    If you have concerns apart from moving the actual data then please give us more details.
    Regards,
    Mike

  • Get SQL Server default data path via ADO/C++?

    Hi,
    I am trying to get the SQL Server default data path via ADO/Visual C++.
    I find the SQL statements that will do that in
    http://stackoverflow.com/questions/1883071/how-do-i-find-the-data-directory-for-a-sql-server-instance/12756990#12756990
    So I just concat all the statements above into a CString object strStatements, then try to open a recordset as follows:
    _RecordsetPtr m_pRecordset;
    m_pRecordset.CreateInstance(__uuidof(Recordset));
    m_pRecordset->Open(_bstrt(strStatements), _variant_t((IDispath *)m_pConnection, true), adOpenDymanic, adLockOptimistic, 0);
    m_pRecordset->MoveFirst(); 
    The last MoveFirst statement will cause com_error, which said
    “ADODB.Recordset error '800a0e78'
    Operation is not allowed when the object is closed.
    It seems that there are no data in the recordset at all. What is the problem?
    Thanks

    Hello,
    Which query statement did you used to get the database data and log file path? Can you get the result by run the query directly with SQL Server Management Studio? For example,  
    SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
    FROM master.sys.master_files
    WHERE database_id = 1 AND file_id = 1
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • SQL Server Parallel Data Warehouse (PDW) Licensing

    Hi All,
    We have a customer that's interested in SQL Server Parallel Data Warehouse
    (PDW). I'm told this is an appliance sold by a manufacturer like Dell or HP. But
    I also see Licensing price on the EA price list.
    Can they also purchase PDW under a VL Agreement?
    Regards,
    DSarao

    Yes. Microsoft sells PDW as an appliance with a software and hardware purchase. Note that the PDW requires both the software and hardware purchase.

  • BI UDI data load conflict using MS SQL Server and date fields

    Hi BW Experts!
    We have found some unexpected problems when we are trying to perform a data extraction process from an SQL database (non-SAP application).
    We are using the BI UDI tool (JDBC Driver/Connector).    The basic data extraction works properly, however we have some specific problems to work with SQL Server fields defined as “Date Time”.
    The JDBC driver automatically intermediate the communication and translate these fields splitting the original SQL date time field into two separated fields with suffix “_D” (for date) and “_T” (for time).
    It works perfect for extraction, but it doesn’t work well when we try to restrict the data selection based on these fields.    
    When we put a date selection into the infopackage data selection area (we already have tried several date formats), the system simply ignores these selection parameters and send a SQL statement without “WHERE” clause to DBMS.   
    Please, anybody has experienced anything like this or know somethings that could help us? 
    This is a standard limitation from SAP BI UDI?
    Thanks in advance and best regards,

    Hi Matt and Thomas
    Many thanks for your replies.
    Yes I have to do the join. Even worse I have to write an Aggregate query like this!
    Select o.F1,o.F2, m.F1,m.F2, count(*)
    from
    table@oracleServer o,
    table@microsoftSQLServer m
    where o.F1=m.F1
    group by o.F1,o.F2, m.F1,m.F2;
    These are 2 different systems (hardware & software) which actually do the same job, they produce transactions for a common business entity. Kind of, both sell tickets for the same ABC ferry company.
    I can not put them side by side on the dashboard, as I need to aggregate the data and present it maybe in a Oracle BI Report for Accounting and Financial reconciliation purposes.
    The truth is, as it is. I can't change it, is too late.
    I have to device a way to harvest both systems as they are. I don't want to move around data. I thought looking at Oracle BI I could write SQL against multiple Data Sources. I am struggling to find a way. As it seems that it can "SQL query" 1 data source at a time.
    I have been hinted on another forum (OracleTURK) to use Oracle Transparent Gateways and Generic Connectivity. http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/toc.htm
    Shame, I have to pay licenses for OWB and Oracle Transparent Gateways. I thought DB vendors can do better. Why do I have to pay to access the other 50% of the market.
    I can understand the performance implications this might have. Because of it I might even be forced at the end to move data (ETL) into a separate database, slice it into partitions and manage it that way. Pitty because currenlty I only need one report out of these systems but seems like will be dear to get.
    Thank you for all your help.
    Kubilay

  • SQL Server 2005 data pull from Oracle

    Hi, I am learning how to use Oracle and I ran into this problem.
    My database is running on SQL Server 2005.
    I have an ODBC connection to Oracle. I also have a VB .Net script that queries the Oracle table that the data resides in.
    When the job is running, and if it stalls, I do not get a timeout error. It locks down my database and no other source systems can feed data to me; these are back logged in the queue.
    Is there an easier way for me to make a connection that will pull data on a consistent basis? Please help ...
    Student Learner

    Learning how to use Oracle does not include taking data from Oracle and putting it into SQL Server.
    From your description of what is happening I agree with BluShadow. This is not an Oracle issue. This is a coding in VB .NET issue.
    Posting the statements you are executing against some unknown version of Oracle would be a good starting point.

  • PerformancePoint in Sharepoint 2010 and SQL Server 2012 data source

    Hi,
    I have a problem on creating PerformancePoint reports in Sharepoint 2010 based on SQL Server 2012 source data.
    I try to create a data source in PerformancePoint dashboard designer, I choose Analysis Services, and I get a following error:
                "The data source cannot be used because PerformancePoint Services is not
    configured correctly...."
    I think it is due to a version of a ADOMD.NET component that needs to be installed, but I am not sure which version is necessary? Could you help
    me with that?
    Of course, if there are any other prerequisites, please, tell me.
    Regards,
    Srdjan Nikitovic

    Did you set unattended service account for your PPS?
    The Data source cannot be used because PerformancePoint
    Services is not configured correctly
    http://ericphan.net/blog/2010/4/19/performance-point-server-error-the-unattended-service-accoun.html
    Amit

  • SQL server as data source for OBI EE : Urgent

    hi everyone,i have been using OBI EE for the past 2 months.I have been using Oracle 10g database as a data source for OBI EE and it worked just fine and now im trying to use SQL server 2005 as my data source.
    My ODBC was succesful and i can import from that database but i get following errors when i try to update row count.
    There was an error while updating row count for "test"."AdventureWorks"."HumanResources"."Departme nt":
    [nQSError: 16001]ODBC error state: S0002 code: 208 message :[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'Department'..
    [nQSError: 16015]SQL statement execution failed.
    Shahzad

    With Sql Server I have always problems with security
    Check this first and then continue..
    1.your odbc connection
    2.in the administrator--> connection pool you have assign the appropriate values for sql -server(check all the options)
    and check the option -->fully qualified table name
    i hope i helped....
    http://greekoraclebi.blogspot.com/
    ///////////////////////////////////////

  • Use a SQL SERVER get date in query

    I want to constrain my returned data by a change date to just return the last rolling 30 days of data. When I use sysdate, I find the plan is to retreive ALL data across the dblink, and then filter it on the Oracle side.
    Is there any way I can use the Sql Server getdate() function, something like
    select * from remote@ss_link
    where upd_date >= getdate() - 30
    Problem - how do I get Oracle to pass the Sql Server specific function call to Sql Server? [BTW I'm on an old version of Oracle...]

    It depends on the product you are using.
    If you are using a gateway you can call remote functions using the getdate@<db link> syntax as described in the Heterogeneous Admin Guide.
    For gateways and generic connectivity you can also use PASSTHROUGH which allows you to pass a statement as it is to the remote database.
    Or at least you can create a view at the SQL Server side which returns the last 30 days and then just select from this view.

  • Sql server 2000 data type

    In sql server 2000, what data type do I use for a field that
    needs to show two decimal places? It is a weight field, so the
    weight in ounces could be something like 12.25 and it needs to
    store it this way in the database. I'm kind of new to sql server,
    so any help would be greatly appreciated!

    You asked "In sql server 2000, what data type do I use for a
    field that needs to show two decimal places?" and I answered
    "decimal and numeric". How much clearer could I be?
    Numeric data types with fixed precision and scale.
    decimal[(p[, s])] and numeric[(p[, s])]
    Fixed precision and scale numbers. When maximum precision is
    used, valid values are from - 10^38 +1 through 10^38 - 1. The
    SQL-92 synonyms for decimal are dec and dec(p, s).
    p (precision)
    Specifies the maximum total number of decimal digits that can
    be stored, both to the left and to the right of the decimal point.
    The precision must be a value from 1 through the maximum precision.
    The maximum precision is 38.
    s (scale)
    Specifies the maximum number of decimal digits that can be
    stored to the right of the decimal point. Scale must be a value
    from 0 through p. The default scale is 0; therefore, 0 <= s
    <= p. Maximum storage sizes vary, based on the precision.
    I recommend that you load SQL Server Books Online on your
    computer, as it is available free from Microsoft as a download and
    it has everything you will probably need to know about SQL Server.
    Or you could just use the online version at
    SQL
    Server 2000 Books Online
    Phil

  • Problem: loading SQL Server 'image' data

    Source database: SQL Server 2000
    OS: Windows 2003 (SP1)
    Oracle: 10g (R2)
    Datatype Mapping: SQL Server ‘image’ to oracle ‘BLOB’
    With the help of OMWB, I created the oracle database schema for a SQL Server DB (offline capture). I have problems when I tried to populate the (destination) database with two tables with ‘image’ datatype:
    Frame.img (as on http://www.sdss.org.uk/mybestdr5/en/help/browser/description.asp?n=Frame&t=U)
    And SpecObjAll.img (as on http://www.sdss.org.uk/mybestdr5/en/help/browser/description.asp?n=SpecObjAll&t=U)
    The part of .ctl files (generated by OMWB) for the two ‘img’ columns is like this:
    IMG CHAR(2000000) "HEXTORAW (:IMG)")
    I failed to load the data with the sql_load_script.sh script, and the log file is like this:
    IMG NEXT ***** CHARACTER
    Maximum field length is 2000000
    Terminator string : '<ec>'
    SQL string for column : "HEXTORAW (:IMG)"
    SQL*Loader-309: No SQL string allowed as part of IMG field specification
    I tried to removed ‘CHAR(2000000)’ in the .ctl files:
    IMG "HEXTORAW (:IMG)")
    But this doesn’t work and the log file is like this:
    IMG NEXT * CHARACTER
    Terminator string : '<ec>'
    SQL string for column : "HEXTORAW (:IMG)"
    SQL*Loader-309: No SQL string allowed as part of IMG field specification
    Any help would be extremely appreciated.
    Helen

    Hi you might want to post your question in General Forum.
    General Database Discussions
    There's very few users visit this forum.

  • Problem: load SQL Server 'varbinary' data

    Source database: SQL Server 2000
    OS: Windows 2003 (SP1)
    Oracle: 10g (R2)
    Datatype Mapping: SQL Server ‘varbinary(1000)’ to oracle ‘BLOB’
    With the help of OMWB, I created the oracle database schema for a SQL Server DB (offline capture). I have problems when I tried to populate the (destination) database with a table with ‘varbinary(1000)’ datatype:
    PlateX.expID (as on http://www.sdss.org.uk/mybestdr5/en/help/browser/description.asp?n=PlateX&t=U) and the with original data is like this: http://dsg.port.ac.uk/~hx/research/sdss/logs/SelectExpidFromPlatex
    The PLATEX.ctl file (generated by OMWB) is like this (http://dsg.port.ac.uk/~hx/research/sdss/logs/PLATEX.ctl):
    load data
    infile 'PLATEX.dat' "str '<er>'"
    into table PLATEX
    fields terminated by '<ec>'
    trailing nullcols
    <SKIP>
    EXPID)
    I failed to load the data with the sql_load_script.sh script, and the log file is like this:
    <SKIP>
    EXPID NEXT * CHARACTER
    Terminator string : '<ec>'
    value used for ROWS parameter changed from 64 to 12
    Record 1: Rejected - Error on table PLATEX, column EXPID.
    Field in data file exceeds maximum length
    <SKIP>
    Record 60: Rejected - Error on table PLATEX, column EXPID.
    Field in data file exceeds maximum length
    MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
    Table PLATEX:
    9 Rows successfully loaded.
    51 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 238392 bytes(12 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 60
    Total logical records rejected: 51
    Total logical records discarded: 0
    Any help would be extremely appreciated.
    Helen
    P.S. previously, I mapped: SQL Server ‘varbinary(1000)’ to ‘RAW(1000)’ in Oracle but failed to populate the data (http://dsg.port.ac.uk/~hx/research/sdss/logs/PLATEX.log).

    Hi Emile,
    regading extracting data from MSSQL with OWB on Unix platform (using Generic Connectivity):
    Re: SQLServer access from AIX Warehouse builder
    Re: OWB on Solaris Connectivity with SQL SERVER on Windows
    We want to load aprox. 100 million records a day.
    I've read some articles about this and the advise was to dump the data from SQL Server to files and load the files with OWB.100 million records per day is not a problem for daily extracting from MSSQL Server if you have 1-2 hour.
    In my opinion dumping to text file is a bad practice and is unnecessary if customer don't have special requirements (for example for security reason).
    SQL Server source table and a Oracle target table without any difficult transformationsIn my opninion the best way process data from MSSQL is to extract data to staging area (schema) on Oracle DB with mappings as simple as possible (ONLY filters, without any join), and most of data processing prefom in Staging area or during moving from staging to DWH.
    Also look at OWB user guide (how to use Generic Connectivity in OWB)
    http://download.oracle.com/docs/cd/E11882_01/owb.112/e10582/loading_ms_data.htm#i1064950
    Regards,
    Oleg
    Edited by: added link to OWB doc with description of using Generic Connectivity

  • SQL Server moving data

    Hi Folks,
    I've recently decided to change the structure of my Db in SQL
    Server 2000, I have setup a new Db and created the tables and made
    the changes, however I need to import all the old records from my
    old DB is this possible?
    Thankyou

    When using the wizard in enterprise manager to import data,
    you can point the columns to each other.
    When you select the tables (source) to import and then select
    the tables to import to (destination), there is another option to
    the right "Transform" click the elipse button, then select the
    transformations tab, select the buttom radio buttons and then in
    the window do what you need to do. Note you can also do a lot of
    hand coding in this window eg vbscript
    Ken

Maybe you are looking for

  • Unable to transfer wma files on computer to 6280

    I have the latest PC suite installed for my Nokia 6280 and when I get into music manager and try to transfer a wma file it comes up with the error message that the file cannot be ripped. Any suggestions to overcome problem?

  • JDeveloper 3.0 Download Problem

    I'm unable to download the first file segment of JDeveloper 3.0 Netscape tells me "... is unable to find the file or directory named /pub/www/otn/jdeveloper/jdev30split/jdev.30a.exe". It looks like there's an extra dot in the file name. FYI: I've bee

  • Computer shuts down when entering BIOS

    When I start the computer, I enter the BIOS and it shuts down after 2 seconds.  Any idea of what could be causing this?

  • How to insert email link

    How do I insert an email address link?

  • Cannot get gmail mail

    Cannot get mail on iphone from gmail account.  I just changed my password on my computer. I used the new password on iphone and I can't get any emails.