Beyond Web Logs - Success Here and Hereafter

Discuss technology, web development, networks and more ...

Tags


First time here? At BeyondWebLogs we discuss technology, web development, personal development, networks and more. You can subscribe to the RSS feed so that you keep up to date with the latest content. Now, on with the regular content...

How to truncate log file size in SQL Server 2005

Normally you could use following to reduce SQL Server log file size:
	USE DatabaseName
	GO
	            DBCC SHRINKFILE(<TransactionLogName>, 1)
	    BACKUP LOG <DatabaseNameWITH TRUNCATE_ONLY
	            DBCC SHRINKFILE(<TransactionLogName>, 1)
	 
	
Here, 1 refers to the identification (ID) number of the file to be shrunk. To obtain a file ID, use the FILE_ID function or search sys.database_files in the current database.
SELECT file_id, name FROM sys.database_files

If target_size is specified, DBCC SHRINKFILE tries to shrink the file to the specified size. If not specified, DBCC SHRINKFILE reduces the size to the default file size.

However, please note that NO_LOG or TRUNCATE_ONLY options with BACKUP command truncates the transaction log. When you use these options, you might not receive a full database backup.

But the trick is that SQL Server 2005 is quite different from SQL Server 2000. To truncate log file is one thing which is different from SQL Server 2000. In SQL Server 2000, you just use Shrink to whatever file size you like. In SQL Server 2005, sometime you cannot shrink the log file at all.

However, there are some tricks to truncate log file for a database in SQL Server 2005. The work environment is MS SQL Server Management Studio.

I. Shrink the log file size at the right time

Immediately after I use the SSIS package or Import the data to the database ( highlight the database->Tasks->Import data … ), or Export the data from the database ( highlight the database->Tasks->Export data … ), I can shrink the log file to the desired size, for example, 1MB. That is, highlight the database->Tasks->Shrink->Files

set the file size, say, 1MB.

Then, click OK and you are done.

II. Eliminate the log file completely

Sometimes we just do not need the big log file. For example, I have 40GB log file. I am sure I do not need this log file and want to get rid of it completely to free up the hard drive space. The logic is

a. Detach the database

b. Rename the log file

c. Attach the database without the log file

d. Delete the log file

Let’s say, the database name is testDev. In the SQL Server Management Studio,

Highlight the database-> Tasks->Detach..-> Click OK Go to log file folder -> rename the testDev_log.ldf to be like testDev_log-aa.ldf, Highlight Databases->Attach…-> Click Add -> add the database testDev, highlight the log file and click the ‘Remove’ button. This means you only attach testDev.mdf After this is done, you can verify the contents of the attached database and then delete the log file.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: SQL Server
Posted by Waqas on Wednesday, July 16, 2008 4:16 PM
Permalink | Comments (0) | Post RSSRSS comment feed

How to force a page to start a file download automatically when the page is loaded

Use this meta tag - where 3 represents the number of seconds and URL_to_document is the path of the download file.
<META HTTP-EQUIV="Refresh" CONTENT="3;URL=URL_to_document">

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Tips n Tricks
Posted by Waqas on Tuesday, July 15, 2008 7:56 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Travel to Pakistan....

great site with user friendly look....

Pakistan has something for everyone. You can choose from a whole list of activities according to your taste and desire. Golfing grounds, fishing spots, bowling alleys, trekking and hiking options, historical places, Shopping centers, Safaris, mountaineering and mountain biking, Skiing, bird watching and much much more for you to feast upon.

click here for further details about travel guide for Pakistan

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by Naveed on Monday, July 14, 2008 3:04 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Move from football manager 2007 to 2008

 

The most in-depth, realistic football management simulation series is back with some fantastic updates and easier to play than ever before. Back for another season, the greatest job on earth!

Click to enter the Official Web site

 

and for FOOTBALL MANAGER LIVE click here

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by naveed on Monday, July 14, 2008 3:03 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Free Gifts... free stuff !!!

Free stuff sample, Free food, beauty free stuff, free baby stuff, free magzine and much more...ALL is in this site, site is just giving links to other sites, who are offering free stuff, samples. one location and many items of daily use.

click here to for further process..

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by Naveed on Monday, July 14, 2008 3:03 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Hunger makes us perform better under pressure

Ever heard the saying that a hungry lion fights better? Well now they have found the scientific reason for it. Apparently you are able to perform better under pressure if you are hungry:
 
 
Also reminds you of the fact that our prophet Muhammed (Sull Allaho Alaihay Wasallam) and his followers used to take their meals only when quite hungry.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by waqas on Monday, July 14, 2008 2:18 PM
Permalink | Comments (0) | Post RSSRSS comment feed

SQL to compare 2 tables

select a.col1, a.col2 ... from tableA a left outer join tableB on a.ID = b.ID where not exists (select a.ID from tableA a where a.ID = b.ID)

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by waqas on Sunday, July 13, 2008 8:52 PM
Permalink | Comments (0) | Post RSSRSS comment feed