How to detect whether a database was created by Restoring (from SQL Server Enterprise Manager) or by Attaching (from SQL Server Enterprise Manager)

Ours is a SQL Server Express Edition 2008-R2 - Windows Forms based application. We have a backup/restore utility provided with our software which performs some logical checks before restoring a backup to ensure that the backup is functionally valid.
However, our clients often use the SQL Server Enterprise Manager utility to 1) Restore backups or 2) Attach data files (kept aside before formatting) directly. This type of action bypasses all our functional checks and allows the user to restore an invalid
backup.
We want to detect that a database was restored/attached and may be we will stop the software from loading if such a thing happened. We think that this information (attach/restore) should be available within some table of SQL Server itself but don't know the
right location/query.
If any change is required in our software to achieve the above, we are ready to do the same too, e.g. may be we need to store some data at some point of time to make the detection happen, please advise.
So, how can we detect that
A database backup was restored using SQL Server Management Utility
(Note: MSDB.Restorehistory may not be a good option as we have often found this table blank for unknown reasons even after backup was restored and just in case user restores the MSDB from MSDB backup or MSDB template due to a data corruption, may be due to
abnormal shutdown of system, then the RestoreHistory table data is gone)
A database was created by attaching a data/log file using SQL Server Management Utility
Any help in this regard is highly appreciated.
Rajarshi
ProjectServer 2007 Beginner

Hi,
For Enterprise edition, we can enable Auditing to audit BACKUP_RESTORE_GROUP in a server audit specification. However, SQL Server audit (fine-grained auditing) feature is not available for the SQL Server Express.
Features Supported by the Editions of SQL Server 2008 R2
http://msdn.microsoft.com/en-us/library/cc645993(v=sql.105).aspx
When a database is attached, SQL Server ERRORLOG will record “Starting up database 'DBNAME'.”
Using ALTER DATABASE OFFLINE and ONLINE will re-open the database files under the SQL Server, the SQL Server error log also contains the following informational message: “Setting database option ONLINE to ON for database 'DBNAME'.”
Additional information:
SQL Server Audit (Database Engine)
http://msdn.microsoft.com/en-us/library/cc280386.aspx
Tracy Cai
TechNet Community Support

Similar Messages

  • How to detect whether browser's java script  disabled or not from server

    How to detect whether browser's java script disabled or not from server side

    I would use a hidden parameter created by a javascript. if this is null, javascript is disabled...

  • How to find whether remote database is up or not (connected via dblink)

    Hi,
    I am using dblink to connect Biz database from Dev database.(Biz, Dev - database names)
    Running dbms job using the dblink from the Dev database to update data on Biz database...
    Problem is dbms job should run if and only if the Biz database is up for which i created the dblink...
    1) How to make sure or implement the check to find whether the Biz is database is up or not in Pl/sql or sql...
    2) How to reschedule the dbms jobs once the database is up
    pls suggest me how to find whether the database is up or not b4 running the dbms job?
    Using- Oracle 10g

    The only way to know whether the remote database is up (and whether the network between the two databases is up and whether the remote database's listener is up and whether the password configured in the database link is correct and whether the local TNS alias is correct, etc) would be to actually run a query against the remote database over the database link. In other words, the way to figure out whether the link is up is to let the job run and catch & handle exceptions when there are problems.
    By default, a job scheduled via DBMS_JOB will automatically reschedule itself if there is an unhandled exception by geometrically backing off (it waits 1 minute after the first failure, 2 minutes after the second, 4, 8, 16, 32 minutes, etc until it's marked as broken after 16 failures). You could, of course, catch appropriate exceptions and handle them in a reasonable fashion and manually reschedule jobs at intervals that make more sense for your particular job.
    Justin

  • How to find out whether Oracle database was upgraded ??

    Hi,
    I need to find out whether my Oracle database was upgraded, If yes how to find out by SQL query .I know their is database_properties table, but when I try to query that it didnt gave me the output which I required.
    Like in SAP we have uvers table which keep info about the upgrade history, whether such history is avaliable in oracle ?? . Iam looking out for output which is like old database Release 9.2.0.7 and new database release 10.2.0.2.
    Whether similar such history is maintained in Oracle database.
    Awaiting for your feedback.
    Kind Regards
    Neenad

    Hi all,
    After checking all the material,I dont think prior to 10g, oracle register its earlier version.
    The views of v$version show the current version for various components and also dba_registry displays info about catlog/catproc versions.
    In 10g, you can use the following query to know the version when the database was broughtup.
    select startup_time,version,db_name from dba_hist_database_instance.
    Anways thanks to all of you.
    Kind Regards
    Neenad

  • How to know whether the database is using SPFILE or PFILE

    How can i know whether the database is using SPFILE or PFILE.
    There are both initSID.ora and spfileSID.ora in default location.
    The registry entry for ORA_SID_PFILE is C:\oracle\ora90\database\initSID.ora
    Also, if it is using SPFILE than how can i modify the non dynamic parameters when the database is in the close state.
    Manu

    If you do not specify a path of a pfile , when you actually startup a database , then it will be use your pfile , if you specify a path explicitly fot a pfile , then it'll use your pfile.
    Also, if it is using SPFILE than how can i modify the non dynamic parameters when the database is in the close state.sql > create spfile from pfile ;
    the spfile will syncronise with pfile .
    Hare krishna
    Alok

  • How to detect when new record is created?

    How can I detect when new record is created in PA30? For example, a newly create record for infotype 6 (address).
    Can I get the information in PCL4?

    Hi Irene,
    the field PAnnnn-AEDTM, nnnn is the infotype number, will give you the date when the record was last changed.
    Not sure if you can precisely get the date when the infotype was created. I dont feel the need to read cluster form the same.
    Regards,
    Pulkit

  • How to use the backup database to create report or update testing

    Hi,
    I have a fully backup of production database in the last month, and I have using Oracle 8.1.7. I want to known how can I use
    this backup to generate a new instance so that I can reproduct some report from the last month data or doing some update testing
    from the backup database with the both production instance and last month instance is opened at the same time. I have tried to
    create a new instance by using the oradim and startup the new sid with mount option and then use the alter database function
    to change the datafile name to the new directory. After this i also create the local service name and change to listerner. I can
    startup the new instance but when i start the production database. I got the error that I can open the database with exclusive.
    I do this in Oracle 7.3.4 and it works. But how can i setting it in Oracle 8.1.7. Anyone can help me and many thanks.

    Hi,
    Create the Second instance thro' Database Configuration Assistant, and Replace with Back up files.Now you can run two instances at parallel.

  • How can detect certain text (String) was input in a JTextArea?

    Hi friends,
    while trying to simulate a telnet shell, i create a JTextArea and put all the input and output text (from telnet) in it. I want to do some info updating in another JPanel when user logs in. Hence I need to detect if user correct logged in, say, a prompt will appear in JTextArea, such as :
    [remote host]>
    I need here a Listener for detecting, could someone tell me how i can do it, or which Class or Interface or Methods i should use? Many thanks in advance!!!
    eedych

    I found something that I hope helps:
    The java.awt.TextArea could be monitored for changes by adding a TextListener for TextEvent's. In the JTextComponent based components, changes are broadcasted from the model via a DocumentEvent to DocumentListeners. The DocumentEvent gives the location of the change and the kind of change if desired.
    Example code :
    DocumentListener myListener = ??;
    JTextArea myArea = ??;
    myArea.getDocument().addDocumentListener(myListener);
    Just use the DocumentListener like any other listener. :) Good luck.

  • How to find - Customer Master IDoc was created Manually or by Change pointe

    Hi all,
    I have an IDoc(Customer master) number (which I have taken from the payload in SXMB_MONI).  I would like to know whether this has been created by a user manually(BD14) or by a change pointer.
    Please help.
    Cheers
    danus

    Hi Vardharajan,
        Yes I agree with you. What I mean by IDoc created by change pointer is - 'IDoc generated because a change(pointer) is tracked by the system', in other words, due to some change made to the data.
    As you know, the other option of creating IDoc is by BDxx transaction. This option is usually used to push (unchanged) data.
    So in essence, what I am interested to know is , has the IDoc been generated because someone made a change using say, VD02 / XD02 or pushed the data manually.
    Please do ask, if anything is not clear.
    cheers
    danus

  • How to see when SR Escalation was created in the Audit Trail

    We have an FDA requirement that the Oracle SR audit trail show when an escalation was created and closed. The audit trail doesn't show this currently in our system. Looking for a way to make this appear in the audit trail.
    We need to be able to provide a single audit trail through the forms (reports are not acceptable) that shows all SR details (as standard functionality) along with when the escalation was created and de-escalated (or closed)
    Any ideas using 11.5.10.2?

    Abhishek 
    I tried to delete the extension, in the Log tab, I only got one error which is:
    Table CI_EEW_ORDERADM_H can't be created with package $TMP
    Seems like the deletion process tried to change the structure CI_EEW_ORDERADM_H.
    I checked this structure, there is already a field added by other developer, but this structure is apparently in another z-package.
    So what I should do now?
    Thanks

  • How to check if a database was not being used since past 90 days ?

    Team ,
    Thanks for your help in advance  !
    I'm looking out for some pointers to determine if a database was NOT BEING Used since last 90 days so that we can decommission them .
    Rajkumar Yelugu

    My personal method which I apply after mailing to all users and managers and after using methods fellow answeres have given
    Take database offline or in a single user mode and keep it like that for 15-20 days if someone is using it they would surely ping you or mail you. Please mail to all repective persons and app owners before taking it offline. As you said you want to decommission
    it so i assume server will be less utilized itself.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • How to detect if my SWF was successfully retrieved or not?

    Hi All,
    We have a full-viewport Flex app that is integral to our business.  "Full-viewport" means that there is nothing else on the page--the Flex app uses the entire viewport.
    The app was developed in Flash Builder 4, and we're using the default HTML/JavaScript that Flash Builder provides for the host page that SWF lives on.  This is using SWFObject.
    From time to time, we get calls from customers who try to use our Flex app and instead get a completely blank page. The only way I can replicate this myself is if I do something to prevent the SWF from downloading.  E.g., if I change the name of the SWF so that SWFObject gets a 404.
    The best guess I can give as to why customer's might get this behavior is that they've got some kind of security software that is blocking SWFs, or at least blocking this particular SWF.
    I am wondering how I can tell, in JavaScript, whether or not the SWF was successfully loaded by SWFObject.  I would like to display a notice to the user saying that the Flash file failed to download, and giving them some suggestions on how to get it to download (e.g., check security software settings, unblock Flash, etc.).  I would then also send a notification to myself notifying me that we had a "blank screen" incident, along with some debugging information about the client's browser.
    If there was a way for me to know in JavaScript the results of the SWFObject embed attempt, I think I could do this.  Suggestions?
      -Josh

    Well, an issue I've run into is that since my Flex app is full-viewport, there's nowhere for me to display an HTML message.  The Flash move displays on top of everything as usual.
    So, even if I were able to work out a way to determine if the SWF failed to load, I wouldn't be able to display it.  But I suppose I could redirect the user to another page where I gave them some useful troubleshooting information.
    Any any rate, this got me thinking--why is Flash movie displaying on top of everything--even if I delete the SWF file, so there is no Flash movie to download.  Hmm... right click on the big white viewport, and you get "Movie not loaded" in the Flash Player context menu.
    So, even though the Flash move is not loaded, the Flash Player did start.  Which leads me to ask... is there a way to interrogate the Flash Player directly, and see if it loaded the movie or not?
    Clearly the Flash Player is aware that the SWF failed to download.  It tells me right in the context menu, "movie not loaded."  The question is, can I programmatically interrogate the Flash Player from within JavaScript?
    Suggestions?
    p.s., I'm aware that I could change the WMODE to transparent to try and let my HTML message show through the SWF, but I want to avoid doing that at all costs :-) I've had too many problems in the past with subtle (and frustrating) errors when I change WMODE away from the default value of Window.

  • How to know whether infotype record is created using PA30 or PA40

    Hi,
    can any one suggest is there any way to know how a record is created in database i.e by performing actions in  PA40 or from PA30.
    Thanks
    Deepthi

    Hmmmm...
    are you asking Record or actions???
    If records then forgot about PA40 it will perform actions not records.
    Coming back PA30-> TO create , modify display
                          PA20 -> TO DISPLAY.
    For PA30 -> after record is created come back to original pa30 screen input the Pernr number , Select/input  infotype number
    then click on the icon Overview button (or SHift + F8) then you can see the data , records.
    or you go and see in SE11 OR SE16 another direct method
    Regards
    sas

  • How to recreate a table that was created 3 years earlier?

    Guru's, a co-worker, before they left, created several tables with indexes, foreign keys, and constraints.
    Is there any way to re-create the table like that person did?
    Example if a user typed this in 3 years ago, is there a way to recreate it today?
    =============
    CREATE TABLE products
    ( product_id numeric(10) not null,
      supplier_id numeric(10) not null,
      supplier_name varchar2(50) not null,
      supplier_phone varchar2(20),
      CONSTRAINT fk_supplier_comp
        FOREIGN KEY (supplier_id, supplier_name)
        REFERENCES supplier(supplier_id, supplier_name)
    =======================
    I'm using SQL Developer.
    Version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    "CORE    10.2.0.4.0    Production"
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    TIA.
    Steve42

    Steve42 wrote:
    Guru's, a co-worker, before they left, created several tables with indexes, foreign keys, and constraints.
    Is there any way to re-create the table like that person did?
    Example if a user typed this in 3 years ago, is there a way to recreate it today?
    =============
    CREATE TABLE products
    ( product_id numeric(10) not null,
      supplier_id numeric(10) not null,
      supplier_name varchar2(50) not null,
      supplier_phone varchar2(20),
      CONSTRAINT fk_supplier_comp
        FOREIGN KEY (supplier_id, supplier_name)
        REFERENCES supplier(supplier_id, supplier_name)
    No - there is no way to guarantee the production of the EXACT DDL that was orginally used.
    The FK constraint in your example was provided 'in-line' as part of the CREATE TABLE statement. But after the statement is executed the 'table' metadata and the FK metadata will not be stored together within Oracle.
    If you use DBMS_METADATA to extract the table DDL it will NOT include the FK constraint. You would need to extract the REF_CONSTRAINT metadata for the table.
    The same comments apply to primary keys.

  • How to know whether alternate layout is created on a document or not?

    Hi,
    I'm working on a plugin for InDesign CS6 and need to find out whether a particular document has alternate layout applied on it or not. Secondly I also want to get the notification whenever alternate layout is being created on a document.
    Can anyone please help me out.

    I'm not into the SDK, but according to the Javascript DOM, alternate layouts are part of Sections -- the section property 'alternateLayoutLength', for example, is "[t]he number of pages in the alternate layout section".
    Perhaps that gives you a clue of where to look?

Maybe you are looking for

  • Error while deleting from BIA index

    HI EXPERTS GETTING BELOW ERROR PLZ GIVE CLARITY ON THIS:      1.A communication error occured, with the TREX TcpIp           2.Error while deleting from BIA index; reconstruction required      THANKS &REGARDS, rAMESH,

  • How to access unread mails of all users in Exchange server without having Passwords and without giving mailbox access to other user.

    Hi all,    I am using Exchange server 2013, my task is to create Service , that need's to  monitor continuously for new mails of all Mailboxes in my server. if any user got new mail i need to get that Mail Subject, Mail Body, Sender Email Address [Fr

  • New Contacts on the Phone, and problem syncing with Outlook.

    I have an iPhone4 with the iOS5 software.  I recently did a sync with my phone (regular sync using iTunes and not iCloud).  I had added some new contacts to my phone, but after the sync was complete, the contact was removed from my phone.  I assume b

  • User Preferences showing weird activity

    I just took a look in my Preferences folder on my user sisde and I am seeing lots of folders with strange one or two charecter names. I click ont he folder and there is nothing inside. Suggestions? Can I delete these if they are empty?

  • Bug in StringValidator ??

    Hi, i think i found a serious problem. I have 2 form items and 2 validators, the form items are TextInput.             <mx:FormItem label="Nombre completo:" required="true">                 <mx:TextInput id="nombreTextInput"/>             </mx:FormIt