How to check last log backup happend in sql server

Hi All,
How to check last log backup happend in sql server
Thanks in advance
Shashikala

Last Tlog Bakcup details
SELECT
   CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
   msdb.dbo.backupset.database_name,
   MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date
FROM   msdb.dbo.backupmediafamily
   INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id
WHERE  msdb..backupset.type = 'L'
GROUP BY
   msdb.dbo.backupset.database_name
ORDER BY
   msdb.dbo.backupset.database_name
--Most Recent Database Backup FULL for Each Database
SELECT 
   CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
   msdb.dbo.backupset.database_name, 
   MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date
FROM   msdb.dbo.backupmediafamily 
   INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id 
WHERE  msdb..backupset.type = 'D'
GROUP BY
   msdb.dbo.backupset.database_name 
ORDER BY 
   msdb.dbo.backupset.database_name
http://www.mssqltips.com/sqlservertip/1601/script-to-retrieve-sql-server-database-backup-history-and-no-backups/
Database -- > Right click -- > Properties -- >
Raju Rasagounder Sr MSSQL DBA

Similar Messages

  • How to monitor Log Backups for MS SQL Server

    Hello all.
    We are running Solution Manager 7.1 on SP Stack 10 and have downloaded the latest template content.
    When configuring the templates for DB monitoring, we noticed that although there is a metric that monitors the age of the last DB backup, there is no such metric to monitor the age of the last successful Log backup, or even a metric to alert us on a failed backup / log backup.
    Has any of you ever had to create a custom metric to monitor either the age of the latest successful log backup for MS SQL Server, or a custom metric to alert on failed backups / log backups?
    If yes, could you provide some instructions on how to create such a metric?
    Thank you in advance for your answers.
    Phevos

    Divyanshu, thank you for your answer.
    I had a similar idea to check the DB log file for failed log backups. The problem is that when I opened the log file from the dbacockpit, I found no errors/warnings for the days that our log backups did not run or failed. Here is a small part of that log to show you what I mean. In this example, the log backup was not running from 25th of July until the 28th of July when we fixed the log backups again, after receiving a disk space warning (log disk drive was almost full):
    The last successful log backup is mentioned in the log: "20140724091524    Backup    Log was backed up"
    Then as the days go by, there is no backup failure entries whatsoever to look for them in the log:
    20140725000023    spid18s    This instance of SQL Server has been using a process ID of 1304 since 5/27/2014 11:50:00 PM (local) 5/28/2014 6:50:00
    20140725000023    spid18s    AM (UTC). This is an informational message only; no user action is required.
    20140726000020    spid21s    This instance of SQL Server has been using a process ID of 1304 since 5/27/2014 11:50:00 PM (local) 5/28/2014 6:50:00
    20140726000020    spid21s    AM (UTC). This is an informational message only; no user action is required.
    20140727000023    spid22s    This instance of SQL Server has been using a process ID of 1304 since 5/27/2014 11:50:00 PM (local) 5/28/2014 6:50:00
    20140727000023    spid22s    AM (UTC). This is an informational message only; no user action is required.
    20140728000022    spid17s    This instance of SQL Server has been using a process ID of 1304 since 5/27/2014 11:50:00 PM (local) 5/28/2014 6:50:00
    20140728000022    spid17s    AM (UTC). This is an informational message only; no user action is required.
    Until finally on the 28th we restored the log backup functionality:
    20140728042814    Backup    Log was backed up. Database: XXX, creation date(time): 2010/12/22(16:45:29)
    So, I find it difficult to deduce an appropriate string to look for in the log, in order to generate an alert when my log backups are not working.
    Any suggestions? Am I looking at the wrong place perhaps?

  • How can I get an accurate count of computers (workstations) logged in to my SQL Server database?

    We license our software by number of workstations.
    I have a query that I have used for years to get an accurate count of the workstations logged in to my SQL Server database. For simplicity, all users use the same login name/password. This is built in to the script that attaches to the DB. They
    have access only to that DB with the exception of
    USE [Master] GRANT VIEW SERVER STATE to MyUser
    The query that has been working is below:
    Basically this relies on the mac address (Master.dbo.sysprocesses.net_addre
    SELECT COUNT(Users) AS UserCount FROM (SELECT COUNT(Master.dbo.sysprocesses.hostname) AS Users FROM Master.dbo.sysprocesses LEFT OUTER JOIN Master.dbo.sysdatabases ON Master.dbo.sysdatabases.dbid = Master.dbo.sysprocesses.dbid WHERE (Master.dbo.sysdatabases.name = 'MyDatabase') GROUP BY Master.dbo.sysprocesses.net_address) AS UserCount_1
    ss), since both Workstation names and ip addresses can be duplicated.
    Recently this has stopped working at a number of customers. Suddenly individual workstations are showing multiple net addresses for the same workstation causing a substantial overcount of users. This may be related to SQL Server 2012 - not sure.
    What I need is a very reliable way to get a count of workstations logged in to my database.
    If anyone can tell me why I am suddenly getting multiple net_addresses for each workstation and how to prevent that that would be one possible solution.
    Otherwise if anyone can give me a rock solid way to get a workstation count other than the above that would be great. Our largest customer is 50 users by the way.
    Thanks in advance for any help.
    Kim

    I think your count is getting skewed because of duplicate rows in sysprocesses because of parallelism. Add DISTINCT to your query:
    SELECT COUNT(Users) AS UserCount
    FROM
    ( SELECT COUNT(DISTINCT Master.dbo.sysprocesses.hostname) AS Users
    FROM Master.dbo.sysprocesses LEFT OUTER JOIN Master.dbo.sysdatabases
    ON Master.dbo.sysdatabases.dbid = Master.dbo.sysprocesses.dbid
    WHERE (Master.dbo.sysdatabases.name = 'MyDatabase'
    GROUP BY Master.dbo.sysprocesses.net_address) AS UserCount_1
    Satish Kartan www.sqlfood.com

  • Ident_Current('TableName') not giving last inserted identity Value in SQL Server 2012

    Hi ,
    Ident_Current('TableName') is not giving last inserted identity Value in SQL Server 2012. 
    Latest Value of ID and Ident_Current is differing for that particular table.  
    Why its happening? Ident_Current value is greater than last inserted ID.
    Please guide me why its happening?

    Here is one example:
    CREATE DATABASE PMCtest ON (NAME = 'PMCtest', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.mdf', SIZE = 25GB )
    LOG ON (NAME = 'PMCtest_log', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.ldf', SIZE = 2GB)
    CREATE TABLE identity_crisis (a int IDENTITY NOT NULL PRIMARY KEY,
                                  b sysname NOT NULL CHECK (b <> 'sysschobjs'))
    go
    INSERT identity_crisis (b) VALUES ('First name')
    INSERT identity_crisis SELECT name FROM sys.objects
    go
    SELECT MAX(a), ident_current('identity_crisis')
    FROM  identity_crisis
    go
    DROP TABLE identity_crisis
    Because the second INSERT statement fails, the identity values from 2 to 12 are lost. This is a very intentional design to promote high concurrency. If you don't want gaps, you should not use IDENTITY, but roll your own.
    Also, beware that ident_current returns database-wide value, so if you insert one row, and another process inserts another row before you interrogate ident_current, you will get the id for the row of the other process.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • Daily backup on Ms sql server management  studio (MS sql 2005).

    I wander how to perform daily backup on Ms sql server management  studio (MS sql 2005).
    In sql server  Entereprise manager (MS sql 2000) I had no problem to shedule.
    But now I do not find this option

    Hi
    Please follow these steps in SQL Server Management Studio in SQL Server 2005 and <b>award points</b>
    1. Start SQL Server Management Studio.
    2. In the Connect to Server dialog box, click the appropriate values in the Server type list, in the Server name list, and in the Authentication list. 
    3. Click Connect.
    4. In Object Explorer, expand Databases.
    5. Right-click the database that you want to back up, click Tasks, and then click Back Up.
    6. In the Back Up Database - DatabaseName dialog box, type the name of the backup set in the Name box, and then click Add under Destination.
    7. In the Select Backup Destination dialog box, type a path and a file name in the Destinations on disk box, and then click OK.
    8. In the Script list, click Script Action to Job.
    9. In the New Job dialog box, click Steps under Select a page, and then click Edit if you want to change the job parameters.
    Note In the Job Step Properties - 1 dialog box, you can see the backup command.
    10. Under Select a page, click Schedules, and then click New.
    11. In the New Job Schedule dialog box, type the job name in the Name box, specify the job schedule, and then click OK.
    Note If you want to configure alerts or notifications, you can click Alerts or Notifications under Select a page.
    12. Click OK two times.
    You receive the following message:
    The backup of database 'DatabaseName' completed successfully.
    Note To verify the backup job, expand SQL Server Agent, and then expand Jobs. When you do this, the SQL Server Agent service must be running.

  • How to calculate the HFM Cube size in SQL Server-2005

    Hi
    How to calculate the HFM Cube size in SQL Server-2005 ?
    Below query used for Oracle. Then what is query for SQL Server?
    SQL> select sum(bytes/1024/1024) from dba_segments where segment_name like 'FINANCIAL_%' and owner='HFM';
    SUM(BYTES/1024/1024)
    SQL> select sum(bytes/1024/1024) from dba_segments where segment_name like 'HSV FINANCIAL%' and owner='HFM';
    SUM(BYTES/1024/1024)
    Regards
    Smilee

    What is your objective? The subcube in HFM is a concept which applies to the application tier - not so much to the database tier. The size of the subcube is the unique number of data strips (data values for January - December inclusive, for example) for the given entity, currency triplet or Parent.Child node. You have to account for parent accounts and customs which don't exist in the database but are generated in RAM in the application tier.
    So, if your objective is to find the largest subcubes, you could do this by querying the database and counting the number of records per entity/value (DCE tables) or parent.child entity combination (DCN tables). I'm not versed in SQL, but I think the script below would just tell you the schema size and not the subcube sizes.
    Check out Accelatis.com for a third party software product that can do this for you. The feature is called the Subcube Analyzer and was written by the same team that wrote HFM, so they ought to know how this works :-)
    --chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How many query possible in 1 second at Sql Server ?

    Hello
    I have 30,000 records. Table have 10 columns. Columns have indexes if column at where condition. And select question will give 20-30 records as result. (select column1, column2,...... column10 from table where columnSecondID=2I. I will use hosting standart
    plane. 
    How many query possible in 1 second at Sql Server 2008 ?
    How many query possible in 1 second at Sql Server 2012 ?
    How many user can visit my web site ?

    Hello
    I have 30,000 records. Table have 10 columns. Columns have indexes if column at where condition. And select question will give 20-30 records as result. I will use hosting standart plane. 
    How many query possible in 1 second at Sql Server 2008 ?
    How many query possible in 1 second at Sql Server 2012 ?
    How many user can visit my web site ?
    That's hard to say. One second for CPU is quite high time and CPU can do lot of work in that time. again, this is relative and depends on what the query is.
    The biggest bottleneck in performance is - Disk IO system. In general, if  the required data is in memory, it can help significantly in improving the performance.
    Remember, CPU will be doing other processing work while it is fetching the data from disk.
    What you need to is  - load test or stress your server. There are some tools available for you to do it. 
    RML : https://support.microsoft.com/en-us/kb/944837?wa=wsignin1.0
    distributed replay : https://msdn.microsoft.com/en-us/library/ff878183.aspx
    to test IO : http://www.brentozar.com/archive/2008/11/storage-performance-testing-with-sqlio/
    read this : http://www.brentozar.com/archive/2012/06/load-test-sqlserver/
    You also need to look at Max worker thread limitations. this depends on the server configuration(64 bit/32 bit) and other factors...
    https://technet.microsoft.com/en-us/library/ms187024%28v=sql.105%29.aspx
    one problem that can happend is thread pool starvation where there are too many connections
    happening if your server cannot keep up with the workload.. like if your cpu is working in processing the queries and cannot accept new connections..
    watch this good youtube video on thread pool starvatioin :
     https://www.youtube.com/watch?v=XJ67oHBM2Hw
    Hope it Helps!!

  • How do I change an IP address of SQL Server which is locally hosted and is not on cluster?

    Hi All,
    How do I change an IP address of SQL Server which is locally hosted and is not on cluster?
    I am asking about IP for SQL Server, is there a way we can assign a different IP to SQL Server other than the server's(host) IP address? like the same what we do in a clustered env.
    aa

    Full explanation can seen here:
    SQL Server: Configure Listening IP, Port, and Named pipe
    http://ariely.info/Blog/tabid/83/EntryId/151/SQL-Server-Configure-Listening-IP-Port-and-Named-pipe.aspx
    [Personal Site] [Blog] [Facebook]

  • How to convert string to an integer in SQL Server 2008

    Hi All,
    How to convert string to an integer in sql server,
    Input : string str="1,2,3,5"
    Output would be : 1,2,3,5
    Thanks in advance.
    Regards,
    Sunil

    No, you cannot convert to INT and get 1,2,3 BUT you can get
    1
    2
    3
    Is it ok?
    CREATE FUNCTION [dbo].[SplitString]
             @str VARCHAR(MAX)
        RETURNS @ret TABLE (token VARCHAR(MAX))
         AS
         BEGIN
        DECLARE @x XML 
        SET @x = '<t>' + REPLACE(@str, ',', '</t><t>') + '</t>'
        INSERT INTO @ret
            SELECT x.i.value('.', 'VARCHAR(MAX)') AS token
            FROM @x.nodes('//t') x(i)
        RETURN
       END
    ----Usage
    SELECT * FROM SplitString ('1,2,3')
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to create database link from oracle to sql server

    Please help with how to create database link from oracle to sql server
    Best regards,
    Vishal

    Please help with how to create database link from oracle to sql server
    Best regards,
    Vishal
    Hi Vishal,
    I found a lof of information regarding how to create a database link from Oracle to SQL Server, please see:
    https://www.google.co.in/?gws_rd=cr&ei=vd3XUvGFO8TgkAXqlYCADg#q=how+to+create+database+link+from+oracle+to+sql+server
    We discuss SQL Server related issue in this forum. If you have any more question regarding Oracle, please post it in Oracle communities forum for better support.
    Regards,
    Elvis Long
    TechNet Community Support

  • How to provide joins between oracle tables and sql server tables

    Hi,
    I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server.
    how to provide joins between oracle tables and sql server tables ? Any help on this
    Regards,
    Malli

    user10675696 wrote:
    I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server. Bad idea most times. Heterogeneous joins do not exactly scale and performance can be severely degraded by network speed and b/w availability. And there is nothing you can do in the application and database layers to address performance issue at the network level in this case - your code's performance is simply at the mercy of network performance. With a single glaring fact - network performance is continually degrading. All the time. Always. Until it is upgraded. When the performance degradation starts all over again.
    If the tables are not small (few 1000 rows each) and row volumes static, I would not consider doing a heterogeneous join. Instead I would rather go for a materialised view on the Oracle side, use a proper table and index structure, and do a local database join.

  • How to connect to External Database, if say SQL server, from Adobe LC

    Hi everyone,
    I have one application, which needs to save and load data from/to an external database,SQL server.I have no idea on how to implement this.But with my knowledge I managed to create DSs and using new data connection wizard, some how I managed to list the fields in the Data View.BUT i still worrying about the way i did is rigt or wrong?.. how can i save and load data to sql server from Adobe LC..Please help me
    Thanks,
    Vinod

    You created the data source on the app server which is the first step. Now you can use the JDBC service to query the database:
    http://livedocs.adobe.com/livecycle/8.2/wb_help/000632.html
    scott

  • How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?

    How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
    I tried using DROP Tables, Truncate Database, Delete and many more but it is not working.  I want to delete all tables using Query Analyzer, i.e. through SQL Query.
    Please help me out in this concern.
    Nishith Shah

    Informative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
    declare @TTName Table
    (TableSchemaTableName
    varchar
    (500),
    [status] int
    default 0);
    with AvailableTables
    (TableSchemaTableName)
    as
    (select
    QUOTENAME(TABLE_SCHEMA)
    +
    +
    QUOTENAME(TABLE_NAME)
    from
    INFORMATION_SCHEMA.TABLES)
    insert into @TTName
    (TableSchemaTableName)
    select *
    from AvailableTables
    declare @TableSchemaTableName varchar
    (500)
    declare @sqlstatement nvarchar
    (1000)
    while 1=1
    begin
    set @sqlstatement
    =
    'DROP TABLE '
    + @TableSchemaTableName
    exec
    sp_executeSQL
    @sqlstatement
    print
    'Dropped Table : '
    + @TableSchemaTableName
    update @TTName
    set [status]
    = 1
    where TableSchemaTableName
    = @TableSchemaTableName
    if
    (select
    count([Status])
    from @TTName
    where [Status]
    = 0)
    = 0
    break
    end

  • How can I connect NetBeans 6.1 with SQL Server 2005?

    Hello guys...
    how can i connect NetBeans 6.1 with SQL Server 2005?
    there is no SQL Server in Server list when we create a new Web Project and choose Server.
    I'm new to NetBeans and this is my first time of posting.
    If has some errors and unwanted disturbing,pls understand me. Thanks.
    (If you have references or some snippets, i'll be glad if u can share.)
    scsfdev

    The JDBC-ODBC bridge wasn't recognizing any of the primary keys I had set up in SQL Server. After lots of head banging, here's the solution I came up with:
    1. Download the appropriate driver. SQL Server 2000 requires the SQL Server 2000 JDBC driver (http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en).
    SQL Server 2005 download: (http://www.microsoft.com/downloads/details.aspx?familyid=C47053EB-3B64-4794-950D-81E1EC91C1BA&displaylang=en)
    3. After installing, right-click on "Libraries" in your project, and choose "Add Library...". Next, give it a name (i.e. SQLServer2000), and select "Class Libraries".
    4. On the next screen, find the JAR files (should be in C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\), and add them under the "Classpath" tab. It will now be available under "Libraries" for future projects.
    5. You can now create a connection to a specific database under the "Services" tab (next to "Projects" and "Files" in the top left of the screen). Select "Microsoft Sql Server 2000 (Microsoft Driver)" and format the "Database URL" like this:
    jdbc:microsoft:sqlserver//YOURSERVER:1433;DatabaseName=YOURDATABASE
    1433 is the default port, though your DBA may have changed it.
    I posted a simpler version of this on the NetBeans.org FAQ page - they had the following title with no content on the answer page:
    "Cannot Select Tables From MsSql 2000 Because It Says No Primary Key Next To Each Table But The Tables DO Have A Primary Key. What Do I Do?"

Maybe you are looking for

  • How to create test database in system (have downloaded mxdb)

    how to create test database in system (have downloaded mxdb)...Can someone pls help as I am new to SAP

  • Can I use the same computer as my daughter to update my iphone?

    Can I use the same computer as my daughter to update my iphone?.....she currently uses 1 computer and I use a laptop to update....I am afraid if something happens to the laptop how will I update my iphone?......Lynne

  • Oracle forms vs apex

    hi all , i want to know the difference between the both , because i've read before that the two of them are for developing enterprise applications, so what is the difference ? is apex for developing applications just for small enterprises ? or what ?

  • When i try to start a a movie its pixelating

    So when ever i try to start a on demand movie either free or paid its pixelating and it shows no sign of change i have fast fowarded tough it still does it

  • License File problem

    I downloaded an eval license for the WebLogic jdbc driver for MSSQL Server 7.0 on NT 4.0 SP5 and am having a problem with the license file. Exception while opening the connection: java.sql.SQLException:java.sql.SQLException: weblogic.common.LicenseNo