SQL restores data before modification, how SQL restores data How SQL restores data

Updated on technology 2024-03-26
10 answers
  1. Anonymous users2024-02-07

    First, if it is an oracle database and it has just been deleted, you can execute the following statement:

    insert

    into the table name.

    select

    from. asof

    timestamp

    to_timestamp('2007-07-2310:20:00',yyyy-mm-dd

    hh24:mi:ss');

    Change the date and time in the statement to the most recent time before you misoperated.

    Two, if it's a sqlserver database, then.

    1. First of all, make a log backup of the database after mistakenly deleted;

    backup

    log database name.

    todisk='The path and the name of the log backup file'

    2. Restore the database to the date of the last full database backup;

    restore

    database

    The name of the database. from

    disk='The path and the name of the database backup file'

    withreplace,norecovery3、Use the log backup in step 1 to restore the database to the moment you deleted it by mistake;

    restore

    log database name.

    fromdisk='The path and the name of the log backup file'

    withrecovery,stopat='The date and time in the 2009-4-24 statement are changed to the most recent time before you misoperated.

    Third, if you have done a database backup before the modification, you can create a new library, restore the backup, export the table data, and then import it into the current database

    Backing up a database to another disk in real time, there are several different ways to do this, such as:

    1. If there are two servers, you can do dual-machine hot standby.

    2. Only one server can be used as disk mirroring.

    3. You can also use special database backup software.

  2. Anonymous users2024-02-06

    A full backup of the recovery database and preparation for log recovery.

    restore

    database

    pubsfrom

    diskn'c:\backups\'

    withnorecovery

    Now you can roll the logs forward to the right point in time and make the database available for use. Note that stopat is prohibited while the database is executing bulk logs.

    restore

    logpubs

    fromdisk=n'c:\backups\'

    withrecovery,stopat='02/11/2002

    Example 2: A statement that uses database tags to restore logs to a predefined point in time.

    Place a tag in the transaction log. Note that the flagged transaction must commit at least one update to mark the log.

    begintran

    mymark

    withmark

    update

    setmarktime

    getdate()

    commit

    tranmymark

    Back up the transaction log as you normally would.

    backup

    logpubs

    todisk='c:\backups\'

    withinit

    You can now restore the database to a log marker. Start by recovering the database and making it ready for log recovery.

    restore

    database

    pubsfrom

    disk=n'c:\backups\'

    withnorecovery

    Now restore the log to the point in time that contains the marker and make it ready for use. Note that stopat is prohibited while the database is executing bulk logs.

    restore

    logpubs

    fromdisk=n'c:\backups\'

    withrecovery,stopat='02/11/2002

    microsoft

    sqlserver

    Development team.

  3. Anonymous users2024-02-05

    Try it, I use it in Oracle.

    create

    tabletablename_bak

    asselect

    fromtablenameasof

    timestamp

    to_timestamp('20081126103435','yyyymmdd

    hh24miss');

    tablename is the table you want to restore, tablename bak is the backup table of tablename, and the data of tablename bak is restored to tablename.

    103435'Change it according to your own situation, change it to the time before you delete the data, but this method can only find out about 2 days of data, and it is estimated that it will not work after a long time.

  4. Anonymous users2024-02-04

    Method: Step 1: Select the database to be restored, right-click, and select Restore under the task.

    Step 2: Select "Source Device" and click on the file behind it to select "....

    Step 3: Add the database that needs to be restored, and the restored database file is suffixed with the backup file (bak);

    Step 4: Select the added restore noisy file, find the "Option" on the upper left corner, check the first item (overwrite the existing database), and click OK.

    Precautions. 1. Be sure to remember to overwrite the existing database;

    2. When performing database operations, please disconnect any use of the current database (e.g., query, database connection use).

  5. Anonymous users2024-02-03

    1. Run Recovery for SQL Server first.

    2. Click: Next > Next--" to enter the Recovery Configuration interface.

    3. Then check Search for Deleted Records, and select the log file path of the database you want to recover.

    4. Click next-》to start the recovery.

    5. Click Next, and select the target database where the recovered data is stored.

    6. Finally, click Finish, and then complete the data recovery.

  6. Anonymous users2024-02-02

    Suggestion: Develop a good habit of backing up the data in the table before updating the data, and then delete it after confirming that there is no problem after the update.

    In addition, when updating, use the process to judge, check the data after the update, and commit if it meets the requirements, otherwise rollback.

  7. Anonymous users2024-02-01

    The SQL 2000 error cannot be restored unless a backup is available before the modification. The problem of backing up a database to another disk in real time is more complex, and SQL 2000 itself has a scheduled task to back up data to any accessible disk location at a certain time, such as 12 p.m. every day. If you must require a real-time backup, consider purchasing professional data backup software, or a real-time backup software that you can search for and share online.

  8. Anonymous users2024-01-31

    Try it, I use it in Oracle.

    create table tablename_bakas select * from tablename as of timestamp to_timestamp('20081126 103435','yyyymmdd hh24miss');

    tablename is the table you want to restore, tablename bak is the backup table of tablename, and the data of tablename bak is restored to tablename.

    20081126 103435'Change it according to your own situation, change it to the time before you delete the data, but this method can only find out about 2 days of data, and it is estimated that it will not work after a long time.

  9. Anonymous users2024-01-30

    1. Run Recovery for SQL Server first.

    2. Click: Next > Next--" to enter the Recovery Configuration interface.

    3. Then check Search for Deleted Records, and select the log file path of the database you want to recover.

    4. Click next-》to start the recovery.

    5. Click Next, and select the target database where the recovered data is stored.

    6. Finally, click Finish, and then complete the data recovery.

  10. Anonymous users2024-01-29

    You can't do it in this situation, my cousin has used Haiyu safe before You can try it.

Related questions
13 answers2024-03-26

Convert nvarchar to decimal and then float, e.g

declare @vnum varchar(20) >>>More

10 answers2024-03-26

The steps to uninstall the SQL Server database are as follows: >>>More

3 answers2024-03-26

At least the basic things must be mastered, such as: the linear structure of the database, the storage method, the way to call Hezheng, and the operation of the table in the database (to use statements to erect the bench to achieve). >>>More

8 answers2024-03-26

Tools Material: Management Studio.

1. First, on the desktop, click on the "Management Studio" icon. >>>More

13 answers2024-03-26

Another way to look: select ,select zy ,sum(zy as yjjefrom zy tbkk,zy brry >>>More