Solved

MSSQL 7 Administration - Compact Database

Posted on 2010-11-11
16
908 Views
Last Modified: 2012-08-13
Hello Gurus,

Have a customer who has an application that makes use of a MSSQL7 instance.  I see no tools whatsoever installed on this machine to admin the database.  Customer is concerned because he was told his database was approaching the limit.  I checked, and sure enough, the c:\mssql7\data\table.mdf file is approaching 2 gigs.

Question: how can I fix this?  I know the name of the server instance, but do not know a username/password combo to connect to it.  Thanks!
0
Comment
Question by:drtester
  • 7
  • 6
  • 2
  • +1
16 Comments
 
LVL 7

Expert Comment

by:mkobrin
ID: 34118042
Using OSQL you can connect using the switch -E for a it to use your windows account for windows authenticated login, as long as your account has permissions
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 34118102
You can download SQL Express version from
http://www.microsoft.com/express/Database/
and chose to install management tools only

A better choice would be to install the SQL Server version 2008 R2 express and port the databse to that version the reason beith that Express 2008 R2 supports upto 10G of data, that space will not be filled ina while
0
 

Author Comment

by:drtester
ID: 34120717
Mkobrin: What is OSQL, and where can I get it?

Ewangoya: Will the SQL Express management tools work with a MSSQL 7 server?  Will I need a username/password to connect, or can I just use the admin login for the machine?

Thanks!
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 34120901
They will work with mssql7

Use Windows Authentication if you don't have the sa password
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 34122477
If you can login as a Windows account that has admin on the box, by default you will have admin authority on SQL (unless s/o removed the related login from SQL, which is typically rare, esp. for 7.0).

You should look at the backup history in msdb.  Also look at packages.  You can delete obsolete backup history and you can move packages from msdb to files.

You can definitely get msdb wayyyyyyyyy below 2G.
0
 

Author Comment

by:drtester
ID: 34125078
ScottPletcher: I will give that a shot.  Where is the backup history and packages you mentioned?  I'm looking on a MSSQL 2005 server, and don't see those things.

0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 34125191
First, see how much backup history you have.

SELECT MIN(backup_finish_date)
FROM msdb.dbo.backuset WITH (NOLOCK)

If it's too much, a "hack" cleanup of *everything* works far better than attempting to use the standard system proc -- it is just horrifically slow on 7.0 and 2000.


As to packages, to totally move a package from SQL to a file, you have to open each package and save them as a file.

Or, if you don't need older versions of packages, and I can't see why you would here, you can just delete all the obsolete versions and just keep the latest versions of each package.

To get an idea of how many obsolete package versions you have, run this command:

SELECT name, COUNT(DISTINCT versionid) AS TotalVersions
FROM msdb.dbo.sysdtspackages WITH (NOLOCK)
GROUP BY name
ORDER BY name
COMPUTE SUM(COUNT(DISTINCT versionid))

Of course the min # of versions for a pkg should be 1; anything over that are older versions of the pkg.

[I really think COMPUTE is valid in 7.0, but I haven't done 7.0 in a *long* time, so if it doesnt work, just remove it.]
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 34125273
If you have a lot of obsolete package versions and you want to get rid of them, do the following:

1) Take a full backup of msdb
2) Run the code below to delete all older versions of pkgs

If you want to save the older version for specific pkg(s), fill in the names where indicated by comments.

Naturally you will have to set on 'show advanced options', then 'allow updates' to run the code.
DELETE FROM pkg

FROM msdb.dbo.sysdtspackages pkg

INNER JOIN (

    SELECT name, MAX(createdate) AS createdate

    FROM msdb.dbo.sysdtspackages

    --WHERE name NOT IN ('') --list of pkgs to KEEP ALL VERSIONS OF

    GROUP BY name

) AS mostRecentPkg ON 

    mostRecentPkg.name = pkg.name AND

    mostRecentPkg.createdate > pkg.createdate

Open in new window

0
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

 
LVL 69

Expert Comment

by:ScottPletcher
ID: 34125285
Be aware that technically a job / whatever could be running a pkg just by its unique versionid.

That's extremely rare, but technically it is possible.  If you run into that after deleting the older versions, just restore msdb to a different db name, and copy the pkg version(s) you need from there to the live msdb.dbo.sysdtspackages.
0
 

Author Comment

by:drtester
ID: 34133549
Hey guys,

I just tried the SQL Management Express, and it says it can't find any database servers.  But it also says it only works with SQL2000 and above.  I can verify this is version 7, and it is indeed running.

I also found the osql.exe... tried running that, but it asks for a password.  Everything I tried doesn't work!

Found another DB utility the application had, but it asks for host, database, username, and password.  I know the host and database, but everything I try for username/password fails.  Help!
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 34136905
SQL 2000 interface will work with 7.0, if you still have Enterprise Manager around.

Sorry, I haven't used Express edition enough for that to be helpful there.
0
 

Author Comment

by:drtester
ID: 34137595
Hmm, I posted another message here, but I don't see it now.  Strange.

Anyways, I did find a command line switch that got me in.  I tried the command: SELECT MIN(backup_finish_date) FROM msdb.dbo.backuset WITH (NOLOCK), but it says that there is no database table named msdb.dbo.backuset.  What now?

0
 

Author Comment

by:drtester
ID: 34178577
Anyone?
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 34188653
Sorry, typo on table name, should be:

FROM msdb.dbo.backuPset WITH (NOLOCK)
0
 

Accepted Solution

by:
drtester earned 0 total points
ID: 34823650
Ended up not doing the job for the customer, as a practical solution was not found. :-(  Thanks anyways.
0
 

Author Closing Comment

by:drtester
ID: 34860172
Did not find a solution.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now