I have a db backup requirement. As shown in the attached image current system is as follows:
There are three source databases such as DB001, DB002 and DB003. Each DB having one table as dbo.EMP and same table schema.
Emp table consists of EmpID (PK) and EmpName.
One backup database i.e, DBbackup
I need as follows:
Looping through all DB: "SELECT NAME FROM sys.sysdatabases WHERE NAME LIKE ''DB00%''"
Check if table dbo.EMP exist in each DB.
If exist then check table "001" exist in DB "DBbackup". >> "SELECT OBJECT_ID('DBbackup.dbo.001','U') AS Check " . This query will return NULL if table "001" not exist.
If not exist then create a table by taking part of DB name like "001" with same schema in "DBbackup" database.
Select into "001", from dbo.Emp before matching row count to avoid duplicate records.
Can you give idea how to achieve it.
Data export of each table is very time consuming. There are more than 150 DBs with huge data. Is there any alternative wizard or inbuilt script is there in SQL server 2005.
Can it be achieve by stored procedure.
Can we put a time stamp in SP to check the processing time for each DB.
Expecting for your solution. Its very urgent.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!