Quantcast
Channel: SQLServerCentral » SQL Server 7,2000 » Administration » Latest topics
Viewing all 482 articles
Browse latest View live

Problem Deleting Backup Data (sp_delete_backuphistory)

$
0
0

I've been runnning log shipping for nearly a year, and on several DB's. My msdb database is now more than 4 Gigs and has about 5 million records in each of the backup tables. Naturally, I have a similar situation on the standby server.

I've been trying to delete data from these DB's using sp_delete_backuphistory. For example, The min(backup_start_date)From backupset is 5/21/04. I attempt to delete data using " EXEC sp_delete_backuphistory '06/1/2004' ". I let the query run for 4.5 hours before stopping it and no data has been deleted. Similarily, it took 4.5 hours to delete the first 17 hours of data from my primary server. (No real processor load while running, log shipping stopped during this time.)

These machines aren't huge, but should be plenty fast. (Dual 2.4 GHz Xeon, 2 Gigs Ram, 10K SCSI w/hardware Raid.)

Am I missing some switch somewhere? Should I delete data from the backup tables myself.

Any help appreciated!

Matt


SQL Server Sharepoint database, restoring Excel objects

$
0
0
I have a SQL Server 2000 database for Sharepoint. User wants a DB restore to recover a website in order to recover Excel sheets that were on the site. Excel objects all report 0k and open up blank. How does SQL Server store Excel sheets/objects and do you all know if there is a way to restore or recover them? Thanks!

Blocking Notification in SQL Server 2000

$
0
0
Hi, I have been researching to see if we can get email when there is blocking in SQL Server 2000 but not able to find any information. Can somebody please let me know that is there any way to do that.Thank You

New SQL Server Express Installation

$
0
0
I'm in the process of bringing up a new SQL Server Express server for a migration. I'm able to ping the server from my laptop. I'm able to RDP into the server and connect to the databases as an Admin using SQL Server Management Studio. However, I am not able to connect to the database from SQL Server Management Studio on my laptop.Any ideas?I've done a one-for-one comparison between the existing server and the new one and confirmed that all of the Logins and permissions are identical.

orphaned spids

$
0
0
Anybody have any info on what causes these? Are there any known issues related to Citrix metaframe 1.8?

Finding out what servers are connected to what database...

$
0
0
Hi Everyone.New to the DBA world here. And i have been given the task of researching what the organisation has and how it is connected as far as MS SQL databases are concerned. I have found out what we have which is multiple servers (varied OS's) running different versions of SQL server. About 60 of them. What i am now struggling with is how they are connected together.Example. We have server1 which is the DB server. I know that it has GUI interface for users which runs on a web server. I also know it has two reports servers which also run on seperate servers.How do i find out or is there a tool or a script or a program which i can use run on server1 which will tell me what is reliant/connected to it?I know there are many varying types of the examble above across my organisation.And no it wasnt documented back at the start or the doco is now so old and out of date it is useless.Thanks guysAaron

CryptAcquireContext failed. Error 0x57

$
0
0

On a production db of over 100 GB, i am getting the below error freqently and i have to restart my server as it becomes dead.

[Microsoft][ODBC SQL Server Driver][SQL Server]CryptoAPI function 'CryptAcquireContext' failed. Error 0x57: The parameter is incorrect.

Alias: DBDest [07-07-16 17:14:04]

Please advise what is the cause of this problem/error and how to resolve this.

OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.

$
0
0
Hi,I am able to excute a select query suceefully in the same server.I am getting below error when i excute the same query in another sql2005 management studio.[OLE/DB provider returned message: The Microsoft Jet database engine cannot open the file '\\142.40.42.105\cas_2000\report\JKTBILL.mdb'. It is already opened exclusively by another user, or you need permission to view its data.]OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: ].Msg 7399, Level 16, State 1, Line 1OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.please help me to resolve this.thanks.

SSIS- Excel Source

$
0
0
Hi,i need your help please! , i'm new to sql server and i have about 30 excel files to extract, the files have different formats and differents types of data.is there a way to extract them all at once or do i have to deal with each file individually with an Excel connection manager per each ???? thank you in advance,

SQL server 2000 not visible

$
0
0
I have sql server 2000 service running in my box but when i click on start -> programs i couldnt find the same. Any suggestion on this please.

SQL Server 2000 Data Loss

$
0
0
TIA for any help...First some background...I am supporting a 2000 instance that does ETL for reporting, custom VB forms, etc. This has been in place for 10+ years and remains mostly unchanged over time. As part of the process, SQL Tasks are used to update fields in tables. Recently, (about 2 weeks ago) some of these updates seemed to stop working. There are no errors in the DTS package yet the updates to these fields appears to not have happened. The remedy now is to simply re-run those updates and populate those fields. This works as expected.This is a 2000 Standard Edition install on a Windows 2008 Standard server. It is virtualized. VMware ESXi 5.5.0 blade with a DS3400 SAN. I'm not certain of the disk layout as that is done by others. The blade itself has 24 logical processors and has 39 virtualized processors so it is a little over the recommended ratio (1.5 V to L).Has anyone seem similar behavior?Thanks.Bill

Script for alter NonClustered Index to Custered across all databases

$
0
0
Hi,I required to have an automation script which will generate a script to alter all non-clustered indexes to clustered index for performance improvement. I am on SQL Server 8.00.760 (SP3). Will it be possible?Also to mention the non-clustered indexes are associated with primary keys of the base tables. Hence to alter them the primary keys need to be dropped along with the foreign keys associated with them and recreate those with 'CLUSTERED' option and foreign keys afterward.While Google-ing I found a script whose purpose is reverse (clustered to non-clustered) and written on SQL Server 2012. Hence not working on SQL Server 8. :([code="other"]/*************************************************************************************************************** * * This Script will perform the following operations: * 1) Drop All RI * 2) Drop All PKEYS * 3) Recreate PKEYS as NONCLUSTERED * 4) Recreate ALL RI * * To do this it will create a work table and populate it with the commands to execute then iterate through * the work table to execute pregenerated commands. * ***************************************************************************************************************/CREATE TABLE #workTable( CommandID INT IDENTITY(1,1), Command VARCHAR(MAX))SET NOCOUNT ON;/*************************************************************************************************************** * * DROP FOREIGN KEYS * * http://stackoverflow.com/questions/159038/can-foreign-key-constraints-be-temporarily-disabled-using-t-sql * ***************************************************************************************************************/INSERT INTO #workTable (Command) VALUES ('PRINT ''-- DROP FOREIGN KEY CONSTRAINTS --''');INSERT INTO #workTable (Command)SELECT 'ALTER TABLE [' + sch.NAME + '].[' + OBJECT_NAME(fk.parent_object_id) + ']' + ' DROP CONSTRAINT ' + '[' + fk.NAME + ']'FROM sys.foreign_keys AS fkINNER JOIN sys.schemas AS sch ON sch.schema_id = fk.schema_idORDER BY fk.NAMEINSERT INTO #workTable (Command) VALUES ('PRINT ''-- DROP FOREIGN KEY CONSTRAINTS -- COMPLETE'' + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10)');/*************************************************************************************************************** * * DROP CLUSTERED PKEYS * * http://social.technet.microsoft.com/wiki/contents/articles/2321.script-to-create-or-drop-all-primary-keys.aspx * ***************************************************************************************************************/INSERT INTO #workTable (Command) VALUES ('PRINT ''-- DROP CLUSTERED KEYS --''');DECLARE @object_id int;DECLARE @parent_object_id int;DECLARE @TSQL NVARCHAR(4000);DECLARE @COLUMN_NAME SYSNAME;DECLARE @is_descending_key bit;DECLARE @col1 BIT;DECLARE @action CHAR(6);SET @action = 'DROP';--SET @action = 'CREATE';DECLARE PKcursor CURSOR FOR select kc.object_id, kc.parent_object_id from sys.key_constraints kc inner join sys.objects o on kc.parent_object_id = o.object_id where kc.type = 'PK' and o.type = 'U' and o.name not in ('dtproperties','sysdiagrams') -- not true user tables order by QUOTENAME(OBJECT_SCHEMA_NAME(kc.parent_object_id)) ,QUOTENAME(OBJECT_NAME(kc.parent_object_id));OPEN PKcursor;FETCH NEXT FROM PKcursor INTO @object_id, @parent_object_id;WHILE @@FETCH_STATUS = 0BEGIN IF @action = 'DROP' SET @TSQL = 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(@parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(@parent_object_id)) + ' DROP CONSTRAINT ' + QUOTENAME(OBJECT_NAME(@object_id)) ELSE BEGIN SET @TSQL = 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(@parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(@parent_object_id)) + ' ADD CONSTRAINT ' + QUOTENAME(OBJECT_NAME(@object_id)) + ' PRIMARY KEY' + CASE INDEXPROPERTY(@parent_object_id ,OBJECT_NAME(@object_id),'IsClustered') WHEN 1 THEN ' CLUSTERED' ELSE ' NONCLUSTERED' END + ' ('; DECLARE ColumnCursor CURSOR FOR select COL_NAME(@parent_object_id,ic.column_id), ic.is_descending_key from sys.indexes i inner join sys.index_columns ic on i.object_id = ic.object_id and i.index_id = ic.index_id where i.object_id = @parent_object_id and i.name = OBJECT_NAME(@object_id) order by ic.key_ordinal; OPEN ColumnCursor; SET @col1 = 1; FETCH NEXT FROM ColumnCursor INTO @COLUMN_NAME, @is_descending_key; WHILE @@FETCH_STATUS = 0 BEGIN IF (@col1 = 1) SET @col1 = 0 ELSE SET @TSQL = @TSQL + ','; SET @TSQL = @TSQL + QUOTENAME(@COLUMN_NAME) + ' ' + CASE @is_descending_key WHEN 0 THEN 'ASC' ELSE 'DESC' END; FETCH NEXT FROM ColumnCursor INTO @COLUMN_NAME, @is_descending_key; END; CLOSE ColumnCursor; DEALLOCATE ColumnCursor; SET @TSQL = @TSQL + ');'; END; INSERT INTO #workTable (Command) SELECT @TSQL; FETCH NEXT FROM PKcursor INTO @object_id, @parent_object_id;END;CLOSE PKcursor;DEALLOCATE PKcursor;INSERT INTO #workTable (Command) VALUES ('PRINT ''-- DROP CLUSTERED KEYS -- COMPLETE'' + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10)');/*************************************************************************************************************** * * CREATE NONCLUSTERED PKEYS * * http://social.technet.microsoft.com/wiki/contents/articles/2321.script-to-create-or-drop-all-primary-keys.aspx * * NOTE: Subsection where script determines if PKEY or not was modified to only create NONCLUSTERED pkeys * ***************************************************************************************************************/INSERT INTO #workTable (Command) VALUES ('PRINT ''-- CREATE NONCLUSTERED PKEYS --''');--SET @action = 'DROP';SET @action = 'CREATE';DECLARE PKcursor CURSOR FOR select kc.object_id, kc.parent_object_id from sys.key_constraints kc inner join sys.objects o on kc.parent_object_id = o.object_id where kc.type = 'PK' and o.type = 'U' and o.name not in ('dtproperties','sysdiagrams') -- not true user tables order by QUOTENAME(OBJECT_SCHEMA_NAME(kc.parent_object_id)) ,QUOTENAME(OBJECT_NAME(kc.parent_object_id));OPEN PKcursor;FETCH NEXT FROM PKcursor INTO @object_id, @parent_object_id;WHILE @@FETCH_STATUS = 0BEGIN IF @action = 'DROP' SET @TSQL = 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(@parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(@parent_object_id)) + ' DROP CONSTRAINT ' + QUOTENAME(OBJECT_NAME(@object_id)) ELSE BEGIN SET @TSQL = 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(@parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(@parent_object_id)) + ' ADD CONSTRAINT ' + QUOTENAME(OBJECT_NAME(@object_id)) + ' PRIMARY KEY' + ' NONCLUSTERED' + ' ('; DECLARE ColumnCursor CURSOR FOR select COL_NAME(@parent_object_id,ic.column_id), ic.is_descending_key from sys.indexes i inner join sys.index_columns ic on i.object_id = ic.object_id and i.index_id = ic.index_id where i.object_id = @parent_object_id and i.name = OBJECT_NAME(@object_id) order by ic.key_ordinal; OPEN ColumnCursor; SET @col1 = 1; FETCH NEXT FROM ColumnCursor INTO @COLUMN_NAME, @is_descending_key; WHILE @@FETCH_STATUS = 0 BEGIN IF (@col1 = 1) SET @col1 = 0 ELSE SET @TSQL = @TSQL + ','; SET @TSQL = @TSQL + QUOTENAME(@COLUMN_NAME) + ' ' + CASE @is_descending_key WHEN 0 THEN 'ASC' ELSE 'DESC' END; FETCH NEXT FROM ColumnCursor INTO @COLUMN_NAME, @is_descending_key; END; CLOSE ColumnCursor; DEALLOCATE ColumnCursor; SET @TSQL = @TSQL + ');'; END; INSERT INTO #workTable (Command) SELECT @TSQL; FETCH NEXT FROM PKcursor INTO @object_id, @parent_object_id;END;CLOSE PKcursor;DEALLOCATE PKcursor;INSERT INTO #workTable (Command) VALUES ('PRINT ''-- CREATE NONCLUSTERED PKEYS -- COMPLETE'' + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10)');/*************************************************************************************************************** * * CREATE FOREIGN KEYS * * http://stackoverflow.com/questions/159038/can-foreign-key-constraints-be-temporarily-disabled-using-t-sql * ***************************************************************************************************************/INSERT INTO #workTable (Command) VALUES ('PRINT ''-- CREATE FOREIGN KEY CONSTRAINTS --''');INSERT INTO #workTable (Command)SELECT 'ALTER TABLE ' + const.parent_obj + ' ADD CONSTRAINT ' + const.const_name + ' FOREIGN KEY ( ' + const.parent_col_csv + ' ) REFERENCES ' + const.ref_obj + '(' + const.ref_col_csv + ')'FROM ( SELECT QUOTENAME(fk.NAME) AS [const_name] ,QUOTENAME(schParent.NAME) + '.' + QUOTENAME(OBJECT_name(fkc.parent_object_id)) AS [parent_obj] ,STUFF(( SELECT ',' + QUOTENAME(COL_NAME(fcP.parent_object_id, fcp.parent_column_id)) FROM sys.foreign_key_columns AS fcP WHERE fcp.constraint_object_id = fk.object_id FOR XML path('') ), 1, 1, '') AS [parent_col_csv] ,QUOTENAME(schRef.NAME) + '.' + QUOTENAME(OBJECT_NAME(fkc.referenced_object_id)) AS [ref_obj] ,STUFF(( SELECT ',' + QUOTENAME(COL_NAME(fcR.referenced_object_id, fcR.referenced_column_id)) FROM sys.foreign_key_columns AS fcR WHERE fcR.constraint_object_id = fk.object_id FOR XML path('') ), 1, 1, '') AS [ref_col_csv] FROM sys.foreign_key_columns AS fkc INNER JOIN sys.foreign_keys AS fk ON fk.object_id = fkc.constraint_object_id INNER JOIN sys.objects AS oParent ON oParent.object_id = fkc.parent_object_id INNER JOIN sys.schemas AS schParent ON schParent.schema_id = oParent.schema_id INNER JOIN sys.objects AS oRef ON oRef.object_id = fkc.referenced_object_id INNER JOIN sys.schemas AS schRef ON schRef.schema_id = oRef.schema_id GROUP BY fkc.parent_object_id ,fkc.referenced_object_id ,fk.NAME ,fk.object_id ,schParent.NAME ,schRef.NAME ) AS constORDER BY const.const_nameINSERT INTO #workTable (Command) VALUES ('PRINT ''-- CREATE FOREIGN KEY CONSTRAINTS -- COMPLETE'' + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10)');SET NOCOUNT OFF;/*************************************************************************************************************** * * Iterate through Work Table on the database * ***************************************************************************************************************/--SELECT * FROM #workTableDECLARE @Command VARCHAR(MAX)DECLARE WorkTableCursor CURSORFOR SELECT Command FROM #workTableOPEN WorkTableCursorFETCH NEXT FROM WorkTableCursorINTO @CommandWHILE @@FETCH_STATUS = 0BEGIN PRINT @Command EXECUTE (@Command) FETCH NEXT FROM WorkTableCursor INTO @CommandENDCLOSE WorkTableCursorDEALLOCATE WorkTableCursorDROP TABLE #workTable[/code]Any help is highly appreciated.Thanks

Delete or move tempdb .ndf file

$
0
0

We have tempdb on a different physical disk than our user databases. A few weeks ago, we were running out of space on that disk during a data warehouse load. Until we could buy a bigger disk, we created a .ndf file on our main data drive. We now have acres of space on the tempdb disk, but SQL Server insists on using both the .ndf and .mdf files during the load. We tried deleting the .ndf file, but got an error message. I found a script example here (love SSC, Steve!) to move the file, but I don't think I need the .ndf anymore and would like to delete it. (A colleague tried the delete from EM, so I don't have the text of the message). Any ideas?

DBCC shrinkfile error - Msg 8985

$
0
0

Hi

I am getting following error when I try to shrink the transaction log:

DBCC SHRINKFILE (wslogdb50_Log, 2000)

Server: Msg 8985, Level 16, State 1, Line 1Could not locate file 'wslogdb50_Log' in sysfiles.DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Any ideas?

Regards

Chandu

Windows 7 and Primavera p6.... database incompatibility

$
0
0
HI FOLKS....I HOPE I WILL BE ABLE TO FIND SOMEONE HERE THAT CAN HELP ME. I RECENTLY PURCHASED A WINDOWS 7 LAPTOP AND I HQVE BEEN TRYING TO DOWNLOAD PRIMAVERA P6 TO MY LAPTOP BUT IT'S COMING UP WITH THE MESSAGE-----'' SQL DATABASE INCOMPATIBLE'' THEN AT THE END HAS AN ERROR MESSAGE THAT SAYS CONNECTION UNSUCCESSFUL.... CAN ANYONE ADVISE ME ON THE STEPS I NEED TO TAKE TO GET THIS P6 TO DOWNLOAD ON MY WINDO'S 7.... THANKS..

Remove database name from CURSOR/

$
0
0
I have written a script to run DBCC CHECKDB, but I want to skip entering the database "master" when user runs the dbcc checkdb with "tablock=y" option enabled.Any generous person can please help me to complete my script?[code="sql"] DECLARE database_cursor CURSOR FOR SELECT NAME FROM sys.databases db WHERE NAME NOT IN ( 'tempdb' ) AND db.state_desc = 'ONLINE' AND source_database_id IS NULL -- REAL DBS ONLY (Not Snapshots) AND is_read_only = 0 OPEN database_cursor FETCH next FROM database_cursor INTO @database_name WHILE @@FETCH_STATUS = 0 BEGIN DECLARE @sql1 NVARCHAR(max) PRINT @database_name --SET @sql1 = ''; SET @sql1 = 'DBCC CHECKDB(''' + @database_name + ''') WITH TABLERESULTS'; IF @PHYSICAL_ONLY = 'Y' SET @sql1 = @sql1 + ', PHYSICAL_ONLY ' IF @tablock = 'Y' SET @sql1 = @sql1 + ', TABLOCK ' SET @sql1 = 'DBCC CHECKDB(''' + @database_name + ''') WITH TABLERESULTS'; IF @allMessages = 'Y' SET @sql1 = @sql1 + ', ALL_ERRORMSGS ' IF @PHYSICAL_ONLY = 'Y' and @tablock = 'Y' BEGIN PRINT 'WRONG OPTION. You can''t choose both @PHYSICAL_ONLY and @tablock Options in the DBCC CHECKDB Syntax..' --SET @sql1 = 'DBCC CHECKDB(''' + @database_name + ''') WITH TABLERESULTS, ALL_ERRORMSGS'; --SET @sql1 = 'DBCC CHECKDB(''' + @database_name + ''') WITH TABLERESULTS, ALL_ERRORMSGS'; RETURN 1; END SELECT @sql1 INSERT INTO dbcc_history ([Error], [Level], [State], MessageText, RepairLevel, [Status], [DbId], [DbFragId],[ObjectId], [IndexId], PartitionId, AllocUnitId,[RidDbid], [RidPruid],[File], Page, Slot, [RefDbId], [RefPruId], RefFile, RefPage, RefSlot,Allocation) EXEC(@sql1) FETCH next FROM database_cursor INTO @database_name END -- Check data in staging table. --SELECT error, -- level, -- Db_name(dbid) AS DBName, -- Object_name(objectid, dbid) AS ObjectName, -- messagetext, -- timestamp --FROM dbcc_history CLOSE DATABASE_CURSOR DEALLOCATE DATABASE_CURSOR END [/code]

getting error "The system cannot find the path specified." using xp_cmdshell

$
0
0
Hi,I am getting error "The system cannot find the path specified." using xp_cmdshell, tyring to copy file from one folder to another. Following is code i execute:DECLARE @fn char(6), @cmd varchar(100)SET @fn=REPLACE(convert(char(8),getdate(),1),'/','')SET @cmd ='Move C:\Shippment_Tracking\ShippmentTracking.txt C:\Shippment_Tracking\Archive\'+@fn+'.txt'EXEC master..xp_cmdshell @cmd

Dropping NON Clustered Indexes

$
0
0
We have a table with over a million rows and there is a primary key on the table.We have an additional non clustered index that indexes 3 columns.During the upload or inserting process, what would happen if I removed the non clustered index.What will happen to the current data and the data being inserted.I believe the data would still be as it is.Any guidance would be appreciated.ThanksGary

How to find all children

$
0
0
HiI am moving all of my data from an old SQL 2000 Enterprise to SQL 2012 Enterprise. What I need is to map all of the views and tables that are used and where, and if possible, cross database.With this info, I can then prioritise the data to be moved to the new server and which views to re-write or kill.Any code that can do this? I already have the list of all of the SP,Views and Tables, just need to join them together now.thanks

System resource exceeded

$
0
0
A strange problem on production.we read data from few text files and update to the database everyday as part of a schedule. Daybefore yesterday we received the below error while performing the operation.[Microsoft][ODBC Text Driver] System resource exceeded.|Error Connecting to database. |[Microsoft][ODBC Text Driver] System resource exceeded.|-2147024882||. The SQL is on a Cluster and few searches in the MSDN revealed that the problem was Memory not being available. But the System showed more than 2GB of free physical memory. SQl was utilizing 1.3 Gb. We made a workaround for our application to skip this part and continue. The problem again repeated yesterday. I restarted the SQL Server and re-ran the schedule and the problem disappeared. Is there any clue what exactly was wrong and is there any solution other than restart if this repeats.
Viewing all 482 articles
Browse latest View live