|
sql
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQL 2000 on W2k fragmentation
patched. The databases, log files and several Gb of backups are all stored on a compressed partition of a raid 5 array. The partition is showing severe fragmentation >90% file frags., so much so that defrag refuses to run properly even though there is over 60% free space on the drive (kbid=294950). The Raid array also holds a system volume which is not fragmented, and has some free space. My plan to fix the problem is as follows: 1) Backup all the existing databases from Enterprise manager to the system volume. 2) Shut down SQL server, and the Agent. 3) Copy all the database files (ldf mdf etc.) to the system volume. 4) Backup to tape the datafiles, and the backups (plus some older ones.) 5) Reformat the volume, removing compression. 6) Recreate the file structure. 7) Copy the database files, and backups back to the fresh volume. 8) Restart SQL Server Does this seem sensible? My only concern is that in deleting and recreating the file structure I will lose the security permissions. SQL would have been installed under the Admin account, do I need to add any special access rights? Many thanks, Box Boxington Headmaker a écrit :
> I'm running SQL 2000 fully service packed, on Windows 2000, also fully 0) script all connexion / user for all databases> patched. > > The databases, log files and several Gb of backups are all stored on a > compressed partition of a raid 5 array. The partition is showing severe > fragmentation >90% file frags., so much so that defrag refuses to run > properly even though there is over 60% free space on the drive > (kbid=294950). The Raid array also holds a system volume which is not > fragmented, and has some free space. > > My plan to fix the problem is as follows: > 1) sp detach all db and log file to sys. > 2) Shut down SQL server, and the Agent. OS defrag all the files> 3) Copy all the database files (ldf mdf etc.) to the system volume. > 4) Backup to tape the datafiles, and the backups (plus some older ones.) > 5) Reformat the volume, removing compression. > 6) Recreate the file structure. > 7) Copy the database files, and backups back to the fresh volume. > 8) Restart SQL Server sp attach all the filesDBCC REINDEX all index except CLUSTER, PK and UNIQUE DBCC INDEXDEFRAG all index of CLUSTER, PK and UNIQUE type. pass SQL script obtain on point 0) A + > > Does this seem sensible? > > My only concern is that in deleting and recreating the file structure I will > lose the security permissions. SQL would have been installed under the > Admin account, do I need to add any special access rights? > > Many thanks, > Box > > -- Frédéric BROUARD, MVP SQL Server, expert bases de données et langage SQL Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com Audit, conseil, expertise, formation, modélisation, tuning, optimisation ********************* http://www.datasapiens.com *********************** "SQLpro [MVP]" <broua***@club-internet.fr> wrote in message <snip>news:uqjmwNbSGHA.5728@tk2msftngp13.phx.gbl... > Boxington Headmaker a écrit : >> I'm running SQL 2000 fully service packed, on Windows 2000, also fully > 0) script all connexion / user for all databases I'm just the network manager, and I've not really any experince with sp's, > 1) sp detach all db and log file to sys. could you elaborate on what to do... >> 2) Shut down SQL server, and the Agent. <snip>> OS defrag all the files As above, could you give some instructions...> >> 8) Restart SQL Server >sp attach all the files > Reindexing / Table defrag (I think that's what the above does?) was done > DBCC REINDEX all index except CLUSTER, PK and UNIQUE > > DBCC INDEXDEFRAG all index of CLUSTER, PK and UNIQUE type. recently on the tables. > pass SQL script obtain on point 0) As above, could you give some more details...> Not sure what this is? Are you saying that doing the above is good?> A + Many thanks, Box Boxington Headmaker a écrit :
> "SQLpro [MVP]" <broua***@club-internet.fr> wrote in message sp_detach is a SQL Server stored procedure thant can just dettach the > news:uqjmwNbSGHA.5728@tk2msftngp13.phx.gbl... >> Boxington Headmaker a écrit : >>> I'm running SQL 2000 fully service packed, on Windows 2000, also fully > <snip> > >> 0) script all connexion / user for all databases >> 1) sp detach all db and log file to sys. > > I'm just the network manager, and I've not really any experince with sp's, > could you elaborate on what to do... files of the database. The syntax is simple and you will find it with examples in MS SQL Server help. > same : stored proc to reverse sp_detach> >>> 2) Shut down SQL server, and the Agent. > <snip> >> OS defrag all the files >> >>> 8) Restart SQL Server > >> sp attach all the files > > As above, could you give some instructions... > OK do not operate>> DBCC REINDEX all index except CLUSTER, PK and UNIQUE >> >> DBCC INDEXDEFRAG all index of CLUSTER, PK and UNIQUE type. > > Reindexing / Table defrag (I think that's what the above does?) was done > recently on the tables. > in SQL Server Entreprise Manager you can obtain the SQL Script for all > >> pass SQL script obtain on point 0) > > As above, could you give some more details... objects. On the database clic right, go to all task / SQL script and check connexion/user this will write the script. To pass the script just open wuery analyser, paste it and execute. > no !!!! ;-) In french A+ mean good by !!!!>> A + > > Not sure what this is? Are you saying that doing the above is good? > By !> Many thanks, > Box > > -- Frédéric BROUARD, MVP SQL Server, expert bases de données et langage SQL Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com Audit, conseil, expertise, formation, modélisation, tuning, optimisation ********************* http://www.datasapiens.com *********************** "SQLpro [MVP]" <broua***@club-internet.fr> wrote in message Okay, thanks.news:OVJwz2bSGHA.5924@TK2MSFTNGP09.phx.gbl... > Boxington Headmaker a écrit : > sp_detach is a SQL Server stored procedure thant can just dettach the > files of the database. > The syntax is simple and you will find it with examples in MS SQL Server > help. > Thanks.> in SQL Server Entreprise Manager you can obtain the SQL Script for all > objects. > On the database clic right, go to all task / SQL script and check > connexion/user > this will write the script. > > To pass the script just open wuery analyser, paste it and execute. > > Au Revoir :-)> no !!!! ;-) In french A+ mean good by !!!! > > > By ! > Box Hi
You can also detach the database through Enterprise manager by right clicking the database and choosing the option from the all tasks menu. John Show quoteHide quote "Boxington Headmaker" wrote: > > "SQLpro [MVP]" <broua***@club-internet.fr> wrote in message > news:OVJwz2bSGHA.5924@TK2MSFTNGP09.phx.gbl... > > Boxington Headmaker a écrit : > > sp_detach is a SQL Server stored procedure thant can just dettach the > > files of the database. > > The syntax is simple and you will find it with examples in MS SQL Server > > help. > > Okay, thanks. > > > > > in SQL Server Entreprise Manager you can obtain the SQL Script for all > > objects. > > On the database clic right, go to all task / SQL script and check > > connexion/user > > this will write the script. > > > > To pass the script just open wuery analyser, paste it and execute. > > > > Thanks. > > > > > no !!!! ;-) In french A+ mean good by !!!! > > > > > > By ! > > > > Au Revoir :-) > Box > > > Box,
Maybe an alternative way. www.sysinternals.com has a free utility called contig.exe which in my experience works much better and faster that defrag. It allows you to defrag individual files and I have used it in the past on database files without any issues. I even ran it on live datbases while users there active without noticeable performance impact. Of course it's always better to do this when the database is offline and make sure you have a backup at hand. Markus Hi
Using a compressed volume for SQL Server is not recommended. If this was not compressed you could have defragged the disc whilst SQL Server was not running without going through the process of backing up/restoring. You should take a SQL Server backup and copy them onto tape for all databases before you start. You may then want to consider detaching each user database after that and re-backing up the master database. This would allow you to re-attach the databases in a different location, so you have the option of changing the directory structures. If it is only mean only the minimum number of (system) databases are available when you bring the system online. Make sure you re-attach the database so the get the same Ids as previously. You may want to think about moving tempdb and the system databases to different spindles if you have the option, hope fully your log files are on a different spindles. If you will need to make sure that the service account that runs SQL Server has read/write permissions to the database files and enough to get there! John Show quoteHide quote "Boxington Headmaker" wrote: > I'm running SQL 2000 fully service packed, on Windows 2000, also fully > patched. > > The databases, log files and several Gb of backups are all stored on a > compressed partition of a raid 5 array. The partition is showing severe > fragmentation >90% file frags., so much so that defrag refuses to run > properly even though there is over 60% free space on the drive > (kbid=294950). The Raid array also holds a system volume which is not > fragmented, and has some free space. > > My plan to fix the problem is as follows: > > 1) Backup all the existing databases from Enterprise manager to the system > volume. > 2) Shut down SQL server, and the Agent. > 3) Copy all the database files (ldf mdf etc.) to the system volume. > 4) Backup to tape the datafiles, and the backups (plus some older ones.) > 5) Reformat the volume, removing compression. > 6) Recreate the file structure. > 7) Copy the database files, and backups back to the fresh volume. > 8) Restart SQL Server > > Does this seem sensible? > > My only concern is that in deleting and recreating the file structure I will > lose the security permissions. SQL would have been installed under the > Admin account, do I need to add any special access rights? > > Many thanks, > Box > > > "John Bell" <jbellnewspo***@hotmail.com> wrote in message That's one of the reasons that I'm formating, not only to lose the news:9D62436B-7BA3-4783-8A92-F2C6C0894224@microsoft.com... > Hi > > Using a compressed volume for SQL Server is not recommended. If this was > not > compressed you could have defragged the disc whilst SQL Server was not > running without going through the process of backing up/restoring. fragmentation, but also the compression. > You should take a SQL Server backup and copy them onto tape for all Will do.> databases before you start. > You may then want to consider detaching each user database after that and The files will be going back to their original locations.> re-backing up the master database. This would allow you to re-attach the > databases in a different location, so you have the option of changing the > directory structures. If it is only mean only the minimum number of > (system) > databases are available when you bring the system online. Make sure you > re-attach the database so the get the same Ids as previously. > You may want to think about moving tempdb and the system databases to Unfortunatley not, the server only has one drive, it a raid 5 array of 5 x > different spindles if you have the option, hope fully your log files are > on a > different spindles. 75Gb disks, giving me 300Gb. Its partitioned into 2 volumes, one for the system files, and one for the databases and backups (these are staged here, and moved to tape backup and offsite wan backup). > If you will need to make sure that the service account that runs SQL How would I check which service account SQL is using?> Server > has read/write permissions to the database files and enough to get there! > John Many thanks for your input,Box Hi
Enterprise manager will give you the Account information on properties of the server, or you can check the services applet in the Administrative tools menu. John Show quoteHide quote "Boxington Headmaker" wrote: > "John Bell" <jbellnewspo***@hotmail.com> wrote in message > news:9D62436B-7BA3-4783-8A92-F2C6C0894224@microsoft.com... > > Hi > > > > Using a compressed volume for SQL Server is not recommended. If this was > > not > > compressed you could have defragged the disc whilst SQL Server was not > > running without going through the process of backing up/restoring. > > That's one of the reasons that I'm formating, not only to lose the > fragmentation, but also the compression. > > > You should take a SQL Server backup and copy them onto tape for all > > databases before you start. > > Will do. > > > You may then want to consider detaching each user database after that and > > re-backing up the master database. This would allow you to re-attach the > > databases in a different location, so you have the option of changing the > > directory structures. If it is only mean only the minimum number of > > (system) > > databases are available when you bring the system online. Make sure you > > re-attach the database so the get the same Ids as previously. > > The files will be going back to their original locations. > > > You may want to think about moving tempdb and the system databases to > > different spindles if you have the option, hope fully your log files are > > on a > > different spindles. > > Unfortunatley not, the server only has one drive, it a raid 5 array of 5 x > 75Gb disks, giving me 300Gb. Its partitioned into 2 volumes, one for the > system files, and one for the databases and backups (these are staged here, > and moved to tape backup and offsite wan backup). > > > If you will need to make sure that the service account that runs SQL > > Server > > has read/write permissions to the database files and enough to get there! > > How would I check which service account SQL is using? > > > John > > Many thanks for your input, > Box > > >
Other interesting topics
Performance: Primary Key = int/nvarchar/guid/...
Stop & Start SQL Server for using scm Internal SQL Server error Trusted Connection failing How do I get my local data in the database on the Internet? Switching off logging on varbinary column Memory allocation in MS-SQL 2000 instances Windows says SQL is installed, but it's not! Why do Ado.net don't use execution plan that Query Analyzer Move 2000 to 2005 |
|||||||||||||||||||||||