Log file shrinking in SQL server

Hi,
I have a log file with initial size of 80 GB in C drive.
Now we are having space issue in C drive, so i tried to shrink the log file, but its not reducing below initial size.
Is it the default behavior or i missed anything while shrinking ?
I used DBCC SHRINKFILE option to shrink it.
How can i change the initial size of the log file ?
If it has been set as 80 GB , because of that am i not able to free space in C drive ?
Thanks,
Vinodh Selvaraj

Hello,
Please check first the log reuse wait state of the databases, may you have to run an additional log backup before you can shrink the log file
select name, log_reuse_wait_desc
from sys.databases
order by name
Olaf Helper
[ Blog] [ Xing] [ MVP]

Similar Messages

  • Steps to move Data and Log file for clustered SQL Server

    Hi guys 
    we have Active'passive SQL 2008R2 cluster environment.
    looking for steps to move Data and log files from user Database  and System Database for  SQL Server Clustered Instance. 
    Currently Data and log  files resides on same drive for user and system Databases..
    Thanks
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Try the below link
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/468de435-3432-45c2-a50b-23519cd2686e/moving-the-system-databases-in-a-sql-cluster?forum=sqldisasterrecovery
    -Prashanth

  • Log File Issue In SQL server 2005 standard Edition

    We have database of size 375GB .The data file has 80 GB free space within .When trying to rebuild the index we had 450 GB free space on the disk where Log file is residing.The rebuild index activity failed due to space issue.added more space and got the
    job done successfully
    The Log file has grow up to 611GB to complete the rebuild index.
    version :SQL server 2005 Standard Edition .Is ther a way to estimate the space required for rebuild index in this version.
    I am aware we notmaly allocate 1.5 times of data file.But in this case It was totaly wrong.
    Any suggestion with examples would be appreciated.
    Raghu

    OK, there's a few things here.
    Can you outline for everybody the recovery model you are using, the frequency with which you take full, differential and transaction log backups.
    Are you selectively rebuilding your indexes or are you rebuilding everything?
    How often are you doing this? Do you need to?
    There are some great resources on automated index maintenance, check out
    this post by Kendra Little.
    Depending on your recovery point objectives I would expect a production database to be in the full recovery mode and as part of this you need to be taking regular log backups otherwise your log file will just continue to grow. By taking a log backup it will
    clear out information from inactive VLF's and therefore allow SQL Server to write back to those VLF's rather than having to grow the log file. This is a simplified version of events, there are caveats.
    A VLF will be marked as active if it still has an open transaction in it or there is a HA option that still requires that data to be available as that data has not been copied to another node yet.
    Most customers that I see take transaction log backups every 15 - 30 minutes, but this really does depend upon how much data your company can afford to lose. That's another discussion for another day.
    Make sure that you take a transaction log backup prior to your job that does your index rebuilds (hopefully a smart job not a sledge hammer job).
    As mentioned previously swapping to bulk logged can help to reduce the size of the amount of information logged during index rebuilds. If you do this make sure to swap back into the full recovery model straight after and perform a full backup. There are
    problems with the ability to do point in time restores whilst in the bulk logged recovery model, so you need to reduce the amount of time you use it.
    Really you also need to look at how your indexes are created does the design of them lead to them being fragmented on a regular basis? Are they being used? Are there better indexes out there that can help performance?
    Hopefully that should put you on the right track.
    If you find this helpful, please mark the post as helpful,
    If you think this solves the problem, please propose or mark it an an answer.
    Please provide details on your SQL Server environment such as version and edition, also DDL statements for tables when posting T-SQL issues
    Richard Douglas
    My Blog: Http://SQL.RichardDouglas.co.uk
    Twitter: @SQLRich

  • Read the c2 log file of the sql server using java

    Hi All,
    i want to read the c2 log file using the core java. how is it possible ? if anybody knows about this please give me the sample code to help me.
    i am also searching on net but i am not getting any result about this? so please help me to doing this task?
    awaited person

    Hi All,
    i want to read the c2 log file using the core java. how is it possible ? if anybody knows about this please give me the sample code to help me.
    i am also searching on net but i am not getting any result about this? so please help me to doing this task?
    awaited person

  • Sql server 2005 log file shrinking issue.

    hi,
    one of my production server database  log file size is increasing continuously,we can take log backup but no use,
    we can change the database recovery model from  full to simple we shrink the log file, log file shrink successfully but space is not released,and we are getting the alerts continuously your physical disk is 95% like that.
    here what we can do how reduced the log file size and how to control the log file size.
    please give me the answer  ASAP.
    Thanks,

    Hello,
    In SQL Server, log truncation occurs automatically as follows:
    • Under the simple recovery model, after a checkpoint.
    • Under the full recovery model or bulk-logged recovery model, after a log backup, if a checkpoint has occurred since the previous backup.
    As Dan posted earlier, when we run the above code, we will get an integer value. The log_reuse_wait_desc value tells us why the transaction log space is not reused. You can refer to the article below to check the root cause. 
    http://msdn.microsoft.com/en-us/library/ms345414.aspx
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Log file shrinking

    hi every one
    i m very happy getting reply from u all
    here my doubt regarding log file shrink.in our environment all high avaliabilities are using (log shippimg,mirroring,replication) now my doubt is if i shrink log file of a database which is these H A what will be the reaction?does i ve to reconfigure or
    not?
    can i make snapshot database  for restoring database?
    waiting for replies with anxiety
    thanks&regards
    chetan.tk

    Hi chetan.kt,
    What is the purpose of shrinking log file? It is recommend that backup the log file frequently as a period of some minutes if the log file is large. In case of more space is required for operation in SQL Server, you may consider to increase the disk space.
    Befor shrinking, you should insight into the reason which leads to the log file grows unexpectedly: A transaction log grows unexpectedly or becomes full on a computer that is running SQL
    Server.
    For log shipping and database mirroring, you can shrink the log file on primary server with non-truncate, and the shrink operation will be log shipped to the secondary servers.
    As for replicated database, you cannot be able to shrink the log file if replication is not completed. You may have a try to mark all replicated transactions as completed by stopping log reader agent and restart after shrinking. For more information:
    Unable to shrink transaction log on replicated database - SQL 2008
    It is not a good idea to shrink the log file. You may have a look at Tibor’s blog about the problem of shrinking log file:
    Why you want to be restrictive with shrink of database files
    Best Regards,
    Stephanie Lv
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Will RMAN delete archive log files on a Standby server?

    Environment:
    Oracle 11.2.0.3 EE on Solaris 10.5
    I am currently NOT using an RMAN repository (coming soon).
    I have a Primary database sending log files to a Standby.
    My Retention Policy is set to 'RECOVERY WINDOW OF 8 DAYS'.
    Question: Will RMAN delete the archive log files on the Standby server after they become obsolete based on the Retention Policy or do I need to remove them manually via O/S command?
    Does the fact that I'm NOT using an RMAN Repository at the moment make a difference?
    Couldn't find the answer in the docs.
    Thanks very much!!
    -gary

    Hello again Gary;
    Sorry for the delay.
    Why is what you suggested better?
    No, its not better, but I prefer to manage the archive. This method works, period.
    Does that fact (running a backup every 4 hours) make my archivelog deletion policy irrelevant?
    No. The policy is important.
    Having the Primary set to :
    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBYBut set to "NONE" on the Standby.
    Means the worst thing that can happen is RMAN will bark when you try to delete something. ( this is a good thing )
    How do I prevent the archive backup process from backing up an archive log file before it gets shipped to the standby?
    Should be a non-issue, the archive does not move, the REDO is transported and applied. There's SQL to monitor both ( Transport and Apply )
    For Data Guard I would consider getting a copy of
    "Oracle Data Guard 11g Handbook" - Larry Carpenter (AKA Dr. Paranoid ) ISBN 978-0-07-162111-2
    Best Oracle book I've read in 10 years. Covers a ton of ground clearly.
    Also Data Guard forum here :
    Data Guard
    Best Regards
    mseberg
    Edited by: mseberg on Apr 10, 2012 4:39 PM

  • 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 load a .xlsx File into a SQL Server Table using a Foreach Loop Container in SSIS?

    I know I've REALLY struggled with this before. I just don't understand why this has to be soooooo difficult.
    I can very easily do a straight Data Pump of a .xlsX File into a SQL Server Table using a normal Excel Connection and a normal Excel Source...simply converting Unicode to DT_STR and then using an OLE DB Destination of the SQL Server Table.
    If I want to make the SSIS Package a little more flexible by allowing multiple .xlsX spreadsheets to be pumped in by using a Foreach Loop Container, the whole SSIS Package seems to go to hell in a hand basket. I simply do the following...
    Put the Data Flow Task within the Foreach Loop Container
    Add the Variable Mapping Variable User::FilePath that I defined as a Variable and a string within the FOreach Loop Container
    I change the Excel Connection and its Expression to be ExcelFilePath ==> @[User::FilePath]
    I then try and change the Excel Source and its Data Access Mode to Table Name or view name variable and provide the Variable Name User::FilePath
    And that's when I run into trouble...
    Exception from HRESULT: 0xC02020E8
    Error at Data Flow Task [Excel Source [56]]:SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured. Error code: 0x80004005.
    Error at Data Flow Task [Excel Source [56]]: Opening a rowset for "...(the EXACT Path and .xlsx File Name)...". Check that the object exists in the database. (And I know it's there!!!)
    I don't understand by adding a Foreach Loop Container to try and make this as efficient as possible has caused such an error unless I'm overlooking something. I have even tried delaying my validations and that doesn't seem to help.
    I have looked hard in Google and even YouTube to try and find a solution for this but for the life of me I cannot seem to find anything on pumping a .xlsX file into SQL Server using a Foreach Loop Container.
    Can ANYONE please help me out here? I'm at the end of my rope trying to get this to work. I think the last time I was in this quandry, trying to pump a .xlsX File into a SQL Server Table using a Foreach Loop Container in SSIS, I actually wrote a C# Script
    to write the contents of the .xlsX File into a .csv File and then Actually used the .csv File to pump the data into a SQL Server Table.
    Thanks for your review and am hoping and praying for a reply and solution.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • 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

  • Display data in log file using PL/SQL procedure

    Just as srw.message is used in Oracle RDF Reports to display data in log file in Oracle Apps, similarly how it is possible to display data in log file using PL/SQL procedure?
    Please also mention the syntax too.

    Pl post details of OS, database and EBS versions.
    You will need to invoke the seeded FND_LOG procedure - see previous discussions on this topic
    Enable debug for pl/sql
    https://forums.oracle.com/forums/search.jspa?threadID=&q=FND_LOG&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    HTH
    Srini

  • Is it possible to load a dump file collected from sql server to orcle 10gR2

    Hi..
    As a part of data migration from legacy systems , we need to migrate only required tables from Sql server to Oracle 10gr2 .
    At present client is telling that he will give it as dump file.
    My question is , Is it possible to load the dump file collected from sql server to oracle 10gR2?
    Thanks in advance ..

    yes, it is.
    Using for example SQL Developer Migration Workbench even allows you to create unload scripts for the desired SQL Server tables and it also creates the DDL scripts for you to create the Oracle tables similar to the SQL Server table AND it alows creates the SQL*Loader scripts that allow you to load the SQL Server generated dump file into the Oracle db.
    Here the link:
    http://www.oracle.com/technology/tech/migration/workbench/index_sqldev_omwb.html
    If you do not want to use this utility, you can also use SQL*Loader to load the content of the SQL Server dump file into the Oracle database; but in this case you have to write the whole SQL*Loader control scripts on your own.
    Edited by: kgronau on Sep 16, 2009 1:54 PM

  • How to store a word file in MS SQL server

    Hi,
    Am new to java, I want to store a Word File into MS SQL Server, pls tell me how to do this.
    What should be Data type I should choose in the MS SQL Server.
    rgds
    Ravi Bharathi

    You will have to simply load the file as a chunk of binary data in a blob (Binary Large Object) type column.
    In MS SQL Server the blob type is known as 'Image'

  • 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

  • Text file import to sql server

    hello experts
    i am looking the best practise considering performance to import a text file to a sql server 2008r2. i have 1,500 files that need to be imported to sql server? thank you as usaual.

    efratb,
    SSIS would be an good option:
    http://www.codeproject.com/Articles/155829/SQL-Server-Integration-Services-SSIS-Part-1-Basics
    http://blog.sqlauthority.com/2011/05/12/sql-server-import-csv-file-into-database-table-using-ssis/
    in addition to ssis, you can also achieve the same thru bcp. check:
    http://databases.about.com/od/sqlserver/a/bcp.htm
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Maybe you are looking for

  • Is it possible to call a mac (ichat) from an itouch (4th generation)?

    Is it possible for an itouch to facetime with ichat on a mac? On the information regarding facetime it appears that it only works with other itouches and iphone 4s. I don't see why I shouldn't be able to call a mac.

  • Postgrey

    I'm starting on the PKGBUILD for postgrey - already put the remaining dependency in AUR (perl-io-multiplex).  Currently, I've got everything put together and have a working PKGBUILD, but I'm looking for some feedback and some advice on how best to wr

  • Trouble with rollover image in div

    Hello there, I am having some trouble with the following. I want to create a rollover image 90 pxl x 90 pxl and put it inside a div 90 pxl x 90 pxl. The div is inside other divs and makes up a kind of a table. I checked that all the div and image siz

  • I updated java yesterday and I get a java.lang.security.exception. how do I fix it?

    I updated java yesterday and I get a java.lang.security.exception. how do i fix this?

  • Please help me deploy!!!!!

    I am new at this, so please help if you can :) I have OAS407, Dev6 installed. I made a report server, listener, cartridge, and rdf file. I can see my report when i type http://machine.domain:port/rwows?report=test.rdf+userid=scott/tig er@database+des