Urgent -- need to restore table from full database backup
Hello,
Can somebody tell me the process for restoring just a table from a full database backup?
I did a full online database backup yesterday, and one of my tables got ruined today. I need to restore it as soon as possible, but I don't know how. When I tried flashback tables, it said that feature wasn't enabled. Should I restore the datafile or the tablespace?
Thanks much,
Nora
If you only want to recover the table and not the other objects in the tablespace, and assuming the table was damaged by a user statement (and not, say, block corruption), you would need to recover your backup to a different system, export the table that was damaged, and import the table into your real production database. If you can recover the entire tablespace to an earlier point in time, or if you can lose some committed changes to other database objects, you may have other options.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
Restore a single table from full database backup
Hi,
I have a full database (10.2.0.1) backup with RMAN.
Suddenly a table got truncated. How to get back that table without restoring and recovering the full database (Point in time recovery) since if I restore the database to an earlier time then the other transactions will hamper.
Also creating a standby database and import export the table will solve my problem. But is there any other way to restore the lost table.
Thanks in advance.No other way to restore the data if you don't want do point in time recovery. If you drop the table then you can restore it from the recyclebin but for the truncate operation it won't help. If you have enabled the flash back table for that particular table then you can restore the data for only that table.
Regards
Asif Kabir -
Restore mailbox from exchange database backup
we are on exchange 2007 sp1 on windows 2008 OS.
one user has lost all emails in his inbox, the only emails existing are that of today's.
We have daily backups of the exchange DB/SG.
Please advise if we can restore/recover his mailbox/inbox from this DB/SG backup. Also if there are any other ways to restore/recover his emails.
Also, we cannot unmount the current DB, what tasks must i perform to mount this DB and restore/recover the mailbox or can I do this without mounting the DB. I dont want to disturb the existing DB/SG.
We use commvault simpana 9 as our backup tool.
please help.Hello,
Come back and mark the replies as answers if they help and unmark them if they provide no help.
I'm marking the reply as answer as there has been no update for a couple of days.
If you come back to find it doesn't work for you, please reply to us and unmark the answer.
Cara Chen
TechNet Community Support -
Question
Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
Answer
When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs.
In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display
the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
-- Create database CDCTest
CREATE DATABASE [CDCTest] ON PRIMARY
( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
use CDCTest;
go
-- creating table
create table Customer
custID int constraint PK_Employee primary key Identity(1,1)
,custName varchar(20)
--Enabling CDC on CDCTest database
USE CDCTest
GO
EXEC sys.sp_cdc_enable_db
--Enabling CDC on Customer table
USE CDCTest
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customer',
@role_name = NULL
GO
--Inserting values in customer table
insert into Customer values('Mike'),('Linda')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking full database backup
backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
insert into Customer values('David'),('Jane')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking differential database backup
BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
GO
Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
Use master
Go
--restore full database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc
Restore Diff backup of the ‘CDCTest’ database.
Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
Replace,
NoRecovery;
Go
--restore differential database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc
Add the Capture and Cleanup jobs in the CDCTest database.
--add the Capture and Cleanup jobs
Use CDCTest
exec sys.sp_cdc_add_job 'capture'
GO
exec sys.sp_cdc_add_job 'cleanup'
GO
insert into Customer values('TEST'),('TEST1')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
Reference
Track Data Changes (SQL Server)
Restoring a SQL Server database that uses Change Data Capture
Applies to
SQL Server 2014
SQL Server 2012
SQL Server 2008 R2
SQL Server 2008
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Question
Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
Answer
When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs.
In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display
the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
-- Create database CDCTest
CREATE DATABASE [CDCTest] ON PRIMARY
( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
use CDCTest;
go
-- creating table
create table Customer
custID int constraint PK_Employee primary key Identity(1,1)
,custName varchar(20)
--Enabling CDC on CDCTest database
USE CDCTest
GO
EXEC sys.sp_cdc_enable_db
--Enabling CDC on Customer table
USE CDCTest
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customer',
@role_name = NULL
GO
--Inserting values in customer table
insert into Customer values('Mike'),('Linda')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking full database backup
backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
insert into Customer values('David'),('Jane')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking differential database backup
BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
GO
Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
Use master
Go
--restore full database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc
Restore Diff backup of the ‘CDCTest’ database.
Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
Replace,
NoRecovery;
Go
--restore differential database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc
Add the Capture and Cleanup jobs in the CDCTest database.
--add the Capture and Cleanup jobs
Use CDCTest
exec sys.sp_cdc_add_job 'capture'
GO
exec sys.sp_cdc_add_job 'cleanup'
GO
insert into Customer values('TEST'),('TEST1')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
Reference
Track Data Changes (SQL Server)
Restoring a SQL Server database that uses Change Data Capture
Applies to
SQL Server 2014
SQL Server 2012
SQL Server 2008 R2
SQL Server 2008
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread. -
Error while importing tables from oracle database
Hi
I am getting the following error when i am trying to import table from oracle database.
my operating system is windows and my database is oracle.
[nQSError: 16001]ODBC error state: IM004 code:0 message:
[Microsoft][ODBC Driver Manager] Driver`s SQLAllocHandle on SQL_HANDLE_ENV failed.
please help me in resolving this issue.
Thanks and Regards,
RajHi Madan,
I have done migration Discoverer Admin EUL Layer into OBIEE repository using below methodology.
Navigate to the <installdrive>\OracleBI\server\Bin directory. There are two important files in this directory: the migration assistant executable file named MigrateEUL.exe and a properties configuration file named MigrationConfig.properties.
Could you please help me how to migrate discoverer plus workbooks and worksheets into OBIEE Answers?
go through below link, It will show navigation steps for migrating of EUL from Discoverer to OBIEE.But i need migration of workbooks and worksheets from Discoverer into OBIEE Answers.
http://www.oracle.com/technology/obe/obe_bi/discoverer/discoverer_1012/discomigration/migrate_disco_biee.htm
This is very great full help to me …
Advance thanks for your suggestions.
Regards
Duraga Prasad. -
How to restore one table from the previous backup in 9.2.0.8 version.
Hi,
How to restore one table from the previous backup in 9.2.0.8 version.
Thanks
-GangaHi,
What is the table you want to restore?
Using export/import is supported with Oracle Apps database (for full database exp/imp, and certain schemas like custom ones). For the Apps schema, I believe it is not supported due to object dependencies and integrity constraints.
Regards,
Hussein -
Full database backup and restore
I have a doubt on the syntax for a full database backup and restore. For a single schema, the syntax for backup & restore is :-
exp JISPREPCORBILLINGPRD501/JISPREPCORBILLINGPRD501 owner=JISPREPCORBILLINGPRD501 STATISTICS=none
log=JISPREPCORBILLINGPRD501_exp.log grants=y constraints=Y rows=y compress=N
file=JISPREPCORBILLINGPRD501
imp <userid/password> file=<export dump file location> fromuser=<export user name> touser=<import user name>
grants=y constraints=Y rows=y log=<import log file location>
I hope, my question is clear.
Please, help in solving the doubt.
regardshi,
thanks, for your answer. I took a export of one schema of the database. But, when I tried to import the schema to the destination database, it showed
imported with errors with the existence of functions showing. The commands used by me for export and import are as follows:-
exp JISPREPCORBILLINGPRD501/JISPREPCORBILLINGPRD501 owner=JISPREPCORBILLINGPRD501 STATISTICS=none log=JISPREPCORBILLINGPRD501_exp.log grants=y constraints=Y rows=y compress=N file=JISPREPCORBILLINGPRD501
imp JISPREPCORBILLINGPRD501/JISPREPCORBILLINGPRD501 file=JISPREPCORBILLINGPRD501 fromuser=JISPREPCORBILLINGPRD501 touser=JISPREPCORBILLINGPRD501 grants=y constraints=Y rows=y log=JISPREPCORBILLINGPRD501_imp.log
Do, we need to drop the existing schema before importing or somethinig else. Please, help.
regards -
Help needed to insert data from different database
Hi ,
I have a requirement where i need to fetch data from different database through database link .Depending on user request , the dblink needs to change and data from respective table from mentioned datbase has to be fetched and populated .Could i use execute immediate for this, would dblink work within execute immediate .If not , could pls let me know any other approach .What does "the dblink needs to change" mean?
Are you trying to dynamically create database links at run-time? Or to point a query at one of a set of pre-established database links at run-time?
Are you sure that you really need to get the data from the remote database in real time? Could you use materialized views/ Streams/ etc to move the data from the remote databases to the local database? That tends to be far more robust.
Justin -
I had to erase my iphone 5 and do a full restore from my icloud back up. My icloud is under one apple id(email address) and my apps and itunes are under a different apple id (since I had itunes long before my iphone). How do I restore my apps? Thanks
I have always had two different ids as long as I have had my phone. Can i restore them from a itunes backup?
-
Getting error while creating table from one database to other.
Hi,
We are getting below error while creating the table from one database to other.
SQL> create table fnd_lobs parallel compress as select * from [email protected];
create table fnd_lobs parallel compress as select * from [email protected]
ERROR at line 1:
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
ORA-02063: preceding line from EEXIT2TEST
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
ORA-02063: preceding line from EEXIT2TEST
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
ORA-02063: preceding line from EEXIT2TEST
ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
too small
Regards,
Bhatiahi
what are the apps version local and remote database???
Snapshot too old errors occur because Oracle can 't reconstruct a consistent
image of a block for the purposes of a consistent read.
I feel at remote database, you are using UNDO, it will be rather easy to iincrease the undo retention time or increase the undo tablespace size.. if you are dealing with roll back segments, you may have rollback segments whose optimal values are too small...
increase roll back segments size and select again then
the following metalink notes might be helpful
ORA-01555 "Snapshot too old" - Detailed Explanation Doc ID: 40689.1
How To Avoid ORA-01555: Snapshot Too Old When Running PAAPIMP Doc ID: 603259.1
OERR: ORA 1555 "snapshot too old (rollback segment too small)" Doc ID: 18954.1 -
Replicate some tables from local database server to Remote database sever
how can i replicate some tables from local database server(Oracle 8.1.7 on windows 2000 server) to a remote database server(Oracle 8.1.7 on Sun Solaris)
whenever there is some insertion or updation on the table of base(main) database it should get updated to the remote database server
or
on time base for example: every 2 hours
please help me!!!!It all depends on waht you are going to do with the data on the remote.
if tehre are no updates there, creating a simple materialized view on the remote to pull it's data from the local should suffice.
If there are updates on the remote, you will more than likely want to look into either Multi-master replication, or updatable materialized views. -
Select query based on joining of tables from different database is taking too long
Hi Team,
Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million records and also Table3 and Table4 (of different database) might
contain close to 1million records.
Select T1.*
From DB1.dbo.Table1 T1
Join DB1.dbo.Table2 T2 on RTRIM(T1.Col3) = RTRIM(T2.Col3)
Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
Join Table3 U on CA.Col2 = U.Col2 AND RTRIM(T2.Col2) = U.Col3
Where U.Col4 NOT IN ('A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7','A8','A9')
And (T1.flg IS NULL OR T1.flg = 'N')
And LTRIM(RTRIM(T2.Col2)) NOT IN ('B1','B2')
How can i improve the performance of this query. Actual thing is update the data in Db1.dbo.table1 based on the conditions but if the select is taking close to 1hr then update will take hours together. Indexes already implemented on all the tables.
Thanks,
Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.Thanks.
Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
This join is not working with spaces if Rtrim is not used.
Thanks! Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users. -
How to import a table from another database using DB toolset.
Hello All
I would like to import a table from one database to another using DB toolbox.
I do not want to import all data to LV and then save them to another database. Instead I would prefer to use SQL syntax.
Does anobody know how to write SQL command to import whole table from one database to another?
I have found in some SQL manual that INSERT INTO should work, but JET4 returns an error that table (e.g. c:\mydatabase\table1) can not be found.
Thanks in advance
Pawelif i don't have TEST table on server B whether COPY command will create this table on server B with the same structure ? If you specify CREATE as a clause the table will be created:
SQL> help copy
COPY
COPY copies data from a query to a table in a local or remote
database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
COPY {FROM database | TO database | FROM database TO database}
APPENDCREATE|INSERT|REPLACE} destination_table
[(column, column, column, ...)] USING query
where database has the following syntax:
username[password]@connect_identifier -
To copy table from one database to another
hai,
I will be really pleased if someone can me tell me that how can i copy table from one database to another. I am having two databases.
GursimranYou can Also do
++ Create a database link on the TARGET to SOURCE
CREATE PUBLIC DATABASE LINK <<DBLNK_NAME>> CONNECT TO <<USER>> IDENTIFIED BY <<PASSOWORD>> USING '<<TNS_NAME>>';
++ And copy as below
CREATE TABLE EMP AS SELECT * FROM EMP@DBLNK_NAME; -
Insert data into fact table from source database tables
here i try to insert data into fact table from source database tables here is the query
ALTER procedure [dbo].[facttable]
as
insert into [pp dw].dbo.Dimfact(Prod_ID,Production_ID,Material_ID,Equip_ID,WC_ID,Recipe_ID,Quantity,costprice)
select Products.[Product ID],[Production ID],Materials.[Material ID],[Equipment ID],[Work Centre ID],[Recipy ID],Quantity,[cost price]
from
[PRODUCTION PLANNING 2].dbo.[Products],
[PRODUCTION PLANNING 2].dbo.[Production Detail],
[PRODUCTION PLANNING 2].dbo.[Material category],
[PRODUCTION PLANNING 2].dbo.[Materials],
[PRODUCTION PLANNING 2].dbo.[Equipment],
[PRODUCTION PLANNING 2].dbo.[Working Centre] ,
[PRODUCTION PLANNING 2].dbo.[Recipies]
where
Products.[Product ID] in (13, 14, 15, 16, 17) and
[Production Detail].[Production ID] in (1, 2, 3) and
[Materials].[Material ID] in (1, 2, 3, 4, 5) and
[Equipment].[Equipment ID] in (1, 2, 3, 4) and
[Working Centre].[Work Centre ID] in (1, 2, 3) and
[Recipies].[Recipy ID] in (1, 2, 3) and
[Material category].[Category ID] in (8, 9, 10, 11, 12, 13)
and when i execute query it shows me error
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dimfact_Dimproduct". The conflict occurred in database "pp dw", table "dbo.Dimproduct", column 'Prod_ID'.
ERD IS
HOW TO SOLVE THIS PROBLEM?I cant see any join conditions in your query posted. Whats the purpose of the query above. It will just bring you a cartesian product (cross join) of tables involved subjected to filters. Are you sure this is the correct query?
The error you're getting may be because you've not yet populated DimProduct or may be because of logic you used in popultaing DimProduct causing it to miss some records which is what query is referring to in above case.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page
Maybe you are looking for
-
How to output data outtside a for loop every 10 iterations​?
Hi friends, does any body help me to sort out this problem? please check the attchement for my vi. all i want is output data from inside for loop to outside for loop every 10 iterations. please do not use local variable. Many thanks dan Attachments:
-
Service Message not created in 4.6c
Hi all We are using SLM 3.2. I am facing problem in creating support message from satellite system (4.6c) it returns the following error: Error in local message system: Function module "/SAPSMOSS/06_CREATE_R3_NOTIFIC" n Message was not created Kin
-
This week, Apple advertised AmpliTube Fender in Time Magazine, but I cannot find it in the Apple App Store. Does it exist?
-
Hi, We are having a problem with just one particular company sending attachments to us. Normal email with no attachments is coming in fine. email with attachments is not. The sender (i.e at the other company) is getting the following message when the
-
public class positiveornegative { public static String numbercheck (int number){ if (number<=0){ System.out.println(false); return ; else if (number>0){ System.out.println(true);