Discussion Locked

SQL LOG FILE

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

My log file is 2,111 mb. I need to know if it is secure to delete it. I need suggestions to handle the file in a secure manner. Is there a general routine adopted by companies to deal with the size of the log? Can I shrink the file? Can I control the size? (SQL 2000).
Also I need help with Desktop engine. For SQL 7, I have installed it on my laptop with fewer problems. Now with SQL 2000, I can't install it.
Please, Help!

8 replies

by p.j.hutchison

For the logs, all you have control over is the number of logs to keep. There are no other properties available.

Are you talking about MSDE version of SQL which is very cut down of SQL 2000. You need to completely remove SQL 7, and I mean all traces.
Otherwise try MySQL instead.

by mtorres7

These are the commands for attach / detach :

sp_detach_db 'angie_may_19_05'

NOW You have to move the files to the desired location

sp_attach_db 'angie_may_19_05', 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\angie_may_19_05_data.mdf', 'e:\sqllog\angie_may_19_05_log.ldf'

VERIFY with sp_helpfile

by spanr

Hi

You can remove log files if you wish. When I have to do it I use the following process:
1) Check the database properties for the owner and note it down;
2) Detach the database;
3) Rename the log file;
4) Reattach the database. SQL will show an error/warning that it can't find the log file, but if you carry on it will create a new one. Also, make sure that the owner setting is the same as the owner you noted in step 1.

You can have SQL Server manage the auto-shrinking of the logs by simply using a maintenance plan. But SQL Server only truncates the logs after there has been a full backup (incrementals don't count). After a full backup is complete, SQL decides that it doesn't need the log information anymore. On some installations, I also find that I need to fully backup the log.

For me, a typical maintenance plan will backup the data 5 or 6 days a week (depending on weekend usage), with it set to remove files older than five days. If I find I am needing to back up the log, it gets backed up on Sunday, with a setting to remove files older than seven days.

There are many backup methods/routines employed - how you do it and when will depend entirely upon the application and the type of data.

There is plenty of info on backup methods and maintaining logs in Books Online and I strongly urge you to read it. There is far greater detail there than space allows me here. In addition, there is a mountain of articles on the net. You have made a great decision join Tech Rep, but if you are setting out to get to know SQL, then I suggest you also join one or more of the SQL specific sites and get their emailed articles.

Hope this helps.

Regards

Rowan Shattky

by spanr

Hi again.

Ran out of space in my first answer.

Now to your problem with your laptop - join the thousands of others. Which is great as that means there is loads of info available on the net.

From your post I am inferring that you have had SQL 7 installed and have now attempted to install SQL 2k. I hope you de-installed 7 first. After de-installing I always fell safest by doing a restart.

Also, when installing SQL 2k, make sure that you are using the correct version - you cannot use the same install that you would use on a server (unless, I guess, your notebook is running a server op sys). You haven't stated which op sys you are running but I am assuming it is not Win 98.

For local installations of SQL 2k, use the Personal Edition if you have it, otherwise the developer version.

You haven't specified what your issue is with your notebook install or what errors you are getting. That information would have been more helpful and enabled me (or anyone else), to be more specific in our responses.

The only way I have been able to overcome failed installations on notebooks is by resorting to hacking around in the registry. I suggest you take a backup first, then simply remove any references in registry to "MSSQL" or "SQL Server" - search for those strings. Once removed, restart and try to reinstall again.

If you continue to have issues, either do a Google search on the error message (you are bound to find something) or post another message here. Or on a specific SQL site. There is plenty of info on the net concerning failed installations of SQL Server - I know, I have read more than my share :-}

Hope this helps get you on track.

Rowan Shattky

This discussion is closed to new replies.