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

Cannot Kill Process stays in KILLED/ROLLBACK status

$
0
0
Hi I have killed one spid bu its still showing this KILLED/ROLLBACK statusSugest me to resolve this with out restating the server please.....[Foun a link here but it's not resolved my issue http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/71d3cd0b-ce4d-4202-8e3b-38b38da90a5b]Thank you in Advance .

Could not find database ID 8. Database may not be activated yet or may be in transition. [SQLSTATE 42000] (Error 913).The step failed.

$
0
0
9:00 AMI have two SQL 2000 boxes.SQL job runs on the Box 1 (SP3)and uses a linked server to Box 2 (SP4).Yesterday the databases on Box 2 referenced in that jobwere backed up and restored.The job ran OK before yesterday Restore.This morning it failed with the error:[quote]Could not find database ID 8. Database may not be activated yet or may be in transition. [SQLSTATE 42000] (Error 913). The step failed.[/quote]I read http://support.microsoft.com/kb/316541and it looks like a bug that can be fixed by SP4.Is this true?10:12 AMThe interesting thing is the problem seems to bejust with one "Import_Log" table.SELECT/DELETE work.Only INSERT [quote]insert [LinkedServ].vsImport.dbo.Import_log(message)values('Msg 913')[/quote]fails. With the same error[quote]Could not find database ID 8...[/quote]Locally on Box 2 INSERT works.It only fails from Box 1 using linked server 4 part query.I checked sysdatabases table in masterand there is no dbid 8.vsImport is under dbid 5.

SQL 2000 @@REMSERVER problem

$
0
0
I am having a problem on a SQL 2000 machine (Yes I know it is really old :-D) When using the @@REMSERVER on 4 of 5 servers it returns the machine value. When I do it on the 5th machine it sends back a NULL. Our DOS Mexico systems use it when tracking information from workstations for efficiency. Does anyone remember how to fix the @@REMSERVER problem of NULLThanksJim PecoraP.S. it is SQL 2000 CU3

Waitresource - Find Exact Key

$
0
0

I am trying to interpret deadlock trace information. This is what I see in the waitresource

waitresource=KEY: 9:72057594065256448 (f20077ea2259)

Can someone help me decipher this?

Thanks!

Error 15023: “User already exists in current database”

$
0
0

I've had to create a new test database using a restore of a live database. The people who will be doing the testing already exist as logins on this server but when I tried to give them access to the test database I got the above message.

I've got the note below as a resolution

1.Select SQL Query Analyser and run

exec sp_dropuser ‘user login’

2.If the user login is unable to be dropped due to ownership of objects, change the ownership of the objects to ‘sa’, then repeat step 1.

3.Recreate the user login.

How can I tell which user login owns which objects (nobody wrote that bit down)? If anyone could let me know, overnight, I'd be grateful. I've got to sort this out in the morning. Will this script work?

sp_changedbowner 'sa'

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

SQL DBA new trend

$
0
0
Hi all, I have a general question to askI'm a production DBA, Looking at the job market, I saw lots of jobs require SSIS exp, Is this a new trend that DBA need to know SSIS package development ?Please let me know, thanks Dave

EventID - 833

$
0
0
Hi,We have Sql server 2005. User databases are in one drive and system databases are in C:/ drive.We are gettting alerts about Event ID: 833 from both user databases and system databases?Is surely indicate IO issues?

I need to Copy/refresh the "data only" to Test from prod

$
0
0
I need to Copy/refresh the "data only" to Test from prod without making changes to users/permissions. Please advice on the best approach to follow through with carrying out this ask

bcp_init error

$
0
0

Would anyone know how to fix this error?

Function: bcp_init

SQLSTATE: HY000

Native Error: 0

Diagnostic: [Microsoft][ODBC SQL Server Driver]Unable to open BCP error-file

I checked the microsoft website and it said that the error file might be non existent or in use. How can i know what is the error file that is being called by bcp_init?

Thanks,

dbcc opentran - SPID (server process ID): 74s

$
0
0
SPID (server process ID): 74sI did n't c this type of Id previously ,I cannot found this SPId in sysprocessesCan u pls help me ?Actually I checked with "dbcc opentran" , so that I found spId : 74 , so I tried to kill , but I couldn't, so restart the MSSqlServer , again Iam getting spId : 74s

shrinkdatabase taking looooong time

$
0
0
I have a db that has one 58 gig data file. The server it was housed on finally ran out of disk space due to this app. I moved stuff off for several years to attempt to keep the app running. The end users have finally agreed to deleting data. After deleting, the data is occupying 35 gig out of the 58. There are numerous indexes, occpuying easily 1/3 of the data file. I started to shrink it. I ran a shrink db ('dbdata',15). As there is not enough room on that server, I moved the db to a new server (3.2 ghz, 4 gig ram, 10,000 RPM RAID 5 drives (300 GIGS)). I have been running shrinkdb for 22 hours. I've been watching activity and saw its has page io latch and the numbers are changing. There is no other activity on the server, I even turned off sql agent. Is this normal for it to take this long?The server is primarily used as a spare where I restore databases to.

Finding out Total Disk Space in TSQL

$
0
0
anyone know any workaround in TSQL who can give this result set?[b]Drive letter | Total Disk Space (MB) | Free Disk Space (MB)----------------------------------------------------------- C 150000 100000 D 160000 130000 Q 100000 90000 S 300000 200000 T 300000 280000[/b]i can get the drive letters and free disk space in MB from "xp_fixeddrives" but i don't know how to get the total disk space in MB using TSQL...thanks in advance...

Can I kill DBCC Shrinkfile???

$
0
0

Is it safe to kill DBCC Shrinkfile? The process has been running for 30 minutes on an 11GB database. I have no idea how much more time it will take to shrink the database and would like to kill it, assuming that would not cause a 30 minute rollback.

Dave

Question about disk space report

$
0
0
I ran disk usage report on a db and it shows that the total space reserved is lower than Data file space reserved.Exemple: Total space reserved: 1 gig Data Files Space Reserved: 2 gig Transaction log space reserved: 2 megOn this db i have 0 meg of unallocated space. Autogrow is enable but it is not triggered.Why is this happening ?

Lock timeout request period exceeded error while trying to execute stored procedures

$
0
0
Hi All,I am trying to execute stored procedure which populates data into the table. It was working fine for few days and not it just throws Lock timeout request period exceeded error 1222 every morning when I try to open Tables and Views in the database.Please let me know how to avoid this:CREATE PROCEDURE [dbo].[sp_WarehouseAttendance_New]ASBEGINSET NOCOUNT ON;---------delete existing warehouse table------------------------------IF OBJECT_ID('dbo.WarehouseAttendance_New', 'U') IS NOT NULL DROP TABLE dbo.WarehouseAttendance_New; --------Create New Table-----------------------------------------------------Weeks--------------------------------------------------------------------With weeks as (select VDC_week_no, VDC_cal_year, min(VDC_day_date) as WeekCommencefrom sql10.ng.dbo.Vdaily_calenderwhere VDC_avail = 'T'group by VDC_week_no, VDC_cal_year),---TTWeeks-----------------------------------------------------------------------------TTWeeks as(SELECT VDC_Cal_Year as REMSYear, [VDC_week_no] as WholeYearWeekNo, WeekCommence, ROW_NUMBER() OVER(PARTITION BY vdc_cal_year ORDER BY VDC_week_no) as TermTimeWeekNo FROM weeks)---Main-----------------------------------------------------------------------------------[left]SELECT CASE WHEN STYR_Age_end_Aug < 16 THEN '1416' WHEN STYR_Age_end_Aug < 19 THEN '1618' ELSE '19+' END AgeBand, REGT_Year, RTRIM(PRPH_ML1) AS PRPH_ML1, RTRIM(PRPH_ML2) AS PRPH_ML2, ML2.GNCD_Description AS [Curriculum Area], RTrim(PRPH_ML2) AS Section, q.GNCD_Description AS Section_Name, LEFT(q.GNCD_Description, 3) AS Dept, rtrim(REGT_Provision_Code) as REGT_Provision_Code, rtrim(PRPH_Title) as PRPH_Title, REGT_Student_ID, STEN_Student_ID, STEN_Funding_Stream, STYR_Age_end_Aug, REGS_Session_No, rtrim(REGH_Class_Register) as REGH_Class_Register, RTRIM(REGH_Register_Title) as REGH_Register_Title, REGH_Day, CASE WHEN REGH_Day = '1' THEN 'Sunday' WHEN REGH_Day = '2' THEN 'Monday' WHEN REGH_Day = '3' THEN 'Tuesday' WHEN REGH_Day = '4' THEN 'Wednesday' WHEN REGH_Day = '5' THEN 'Thursday' WHEN REGH_Day = '6' THEN 'Friday' WHEN REGH_Day = '7' THEN 'Saturday' END AS Register_Day, [REGH_Start_Time] ,[REGH_End_Time], CASE WHEN (REGTrgstudt.REGT_Provision_Code LIKE '27%' OR REGT_Provision_Code LIKE 'MA27%' OR REGT_Provision_Code LIKE 'FS%') THEN 'FunctionalSkill' WHEN REGT_Provision_Code LIKE '16%' THEN 'GCSE' WHEN REGT_Provision_Code LIKE '%/F%' OR REGT_Provision_Code LIKE '%/D%' OR REGT_Provision_Code LIKE '%/E%' OR REGT_Provision_Code LIKE '%/X%' THEN 'Main' ELSE 'Addition' END AS CourseType, CASE WHEN isnull(RGAT_Present,'X') IN ('N', 'Y','X') and REGS_Session_Date<GETDATE() THEN REGS_Duration - isnull(REGD_Mins_Late,0) ELSE 0 END AS Mins_Poss, CASE WHEN isnull(RGAT_Present,'X') = 'Y' and REGS_Session_Date<GETDATE() THEN REGS_Duration - REGD_Mins_Late ELSE 0 END AS Mins_Att, CASE WHEN RGAT_Present = 'Y' and REGS_Session_Date<GETDATE() THEN REGD_Mins_Late ELSE 0 END AS Mins_Late, [REGS_Session_Date] as Session_Date, TermTimeWeekNo, REGH_ISN, PRPH_ISN, STUD_Surname, STUD_Forename_1, REGD_Attendance_Mark, REGT_start_date, REGT_End_date, WeekCommence, STFM_LearnFAMCode, CASE WHEN STFM_LearnFAMCode=1 THEN '14-15 year old learner is eligible for free meals' WHEN STFM_LearnFAMCode=2 THEN '16-19 year old learner is eligible for and in receipt of free meals' ELSE 'N/A' END AS FreeMealsIndicator, CASE WHEN STFM_LearnFAMCode=36 THEN 'Care to Learn (C2L) (EFA funded only)' WHEN STFM_LearnFAMCode=55 THEN '16-19 Bursary Fund - learner member of a vulnerable group (EFA funded only)' WHEN STFM_LearnFAMCode=56 THEN '16-19 Bursary Fund - learner awarded discretionary bursary (EFA funded only)' WHEN STFM_LearnFAMCode=57 THEN 'Residential support (EFA funded only)' WHEN STFM_LearnFAMCode=58 THEN '19+ Hardship (Skills Funding Agency funded learners only)' WHEN STFM_LearnFAMCode=59 THEN '20+ Childcare (Skills Funding Agency funded learners only)' WHEN STFM_LearnFAMCode=60 THEN 'Residential Access Fund (Skills Funding Agency funded learners only)' WHEN STFM_LearnFAMCode IN (61, 62, 63, 64, 65) THEN 'Unassigned' ELSE 'N/A' END AS Bursary, CASE WHEN STUD_Gender='M' THEN 'Male' WHEN STUD_Gender='F' THEN 'Female' END AS Gender, CASE WHEN STUD_Ethnicity= 31 THEN 'White - English / Welsh / Scottish / Northern Irish / British'WHEN STUD_Ethnicity= 32 THEN 'White - Irish'WHEN STUD_Ethnicity= 33 THEN 'White - Gypsy or Irish Traveller'WHEN STUD_Ethnicity= 34 THEN 'White - Any Other White background'WHEN STUD_Ethnicity= 35 THEN 'Mixed / Multiple Ethnic group - White and Black Caribbean'WHEN STUD_Ethnicity= 36 THEN 'Mixed / Multiple Ethnic group - White and Black African'WHEN STUD_Ethnicity= 37 THEN 'Mixed / Multiple Ethnic group - White and Asian'WHEN STUD_Ethnicity= 38 THEN 'Mixed / Multiple Ethnic group - Any Other Mixed / multiple ethnic background'WHEN STUD_Ethnicity= 39 THEN 'Asian / Asian British - Indian'WHEN STUD_Ethnicity= 40 THEN 'Asian/ Asian British - Pakistani'WHEN STUD_Ethnicity= 41 THEN 'Asian / Asian British - Bangladeshi'WHEN STUD_Ethnicity= 42 THEN 'Asian / Asian British - Chinese'WHEN STUD_Ethnicity= 43 THEN 'Asian / Asian British - Any other Asian background'WHEN STUD_Ethnicity= 44 THEN 'Black / African / Caribbean / Black British - African'WHEN STUD_Ethnicity= 45 THEN 'Black / African / Caribbean / Black British - Caribbean'WHEN STUD_Ethnicity= 46 THEN 'Black / African / Caribbean / Black British - Any other Black / African / Caribbean background'WHEN STUD_Ethnicity= 47 THEN 'Other ethnic group - Arab'WHEN STUD_Ethnicity= 98 THEN 'Any Other'WHEN STUD_Ethnicity= 99 THEN 'Not provided'END AS Ethnicity,CASE WHEN g.GNUC_Flag_1 = 1 THEN 'Yes'WHEN g.GNUC_Flag_1 = 0 THEN 'No'END AS [Looked After Child],CASE WHEN SUB1.GNUC_Type = 'STYR' THEN 'Yes'WHEN SUB1.GNUC_Type != 'STYR' THEN 'No'END AS ALSINTO WarehouseAttendance_New FROM sql10.ng.dbo.REGTrgstudt INNER JOINsql10.ng.dbo.REGSrgsessn ON REGT_REGH_ISN = REGS_REGH_ISN inner join sql10.ng.dbo.Vdaily_calenderON REGS_Session_Date=VDC_day_date INNER JOIN TTWeeks on REGT_year=TTWeeks.REMSYearand VDC_week_no=WholeYearWeekNo and VDC_cal_year=REMSYearINNER JOINsql10.ng.dbo.REGHrghdr ON REGH_ISN = REGT_REGH_ISN INNER JOINsql10.ng.dbo.PRPHProvisionHeader ON REGT_Provision_Code = PRPH_Code INNER JOINsql10.ng.dbo.GNCDgncodes AS ML2 ON ML2.GNCD_General_Code = PRPH_ML2 AND ML2.GNCD_Code_Type = 'M2' INNER JOINsql10.ng.dbo.STEN ON STEN_Student_ID = REGTrgstudt.REGT_Student_ID AND STEN_Provision_Code = REGTrgstudt.REGT_Provision_Code ANDSTEN_Provision_Instance = REGT_Provision_Instance LEFT OUTER JOIN sql10.ng.dbo.STFMLearnerFAM ON STFM_Year = STEN_Year AND STFM_Student_ID = STEN_Student_ID INNER JOINsql10.ng.dbo.STYRstudentYR ON STYR_Student_ID = REGT_Student_ID AND STYR_Year = REGT_Year INNER JOIN (SELECT GNUC_Type, GNUC_Year, GNUC_Entity_ISN FROM sql10.ng.dbo.GNUCustom WHERE (GNUC_Year IN ('2013', '2014', '2015'))) AS SUB1 ON REGT_Year = SUB1.GNUC_Year AND STYR_ISN = SUB1.GNUC_Entity_ISNINNER JOIN (SELECT ACYR_College_YearFROM sql10.ng.dbo.ACYRWHERE (ACYR_College_Year in (2015, 2014, 2013, 2012))) AS SUB ON REGT_Year = SUB.ACYR_College_YearINNER JOIN sql10.ng.dbo.STUDStudent on STYR_Student_ID=STUD_Student_IDINNER JOIN sql10.ng.dbo.GNUCustom g ON STUD_ISN = g.GNUC_Entity_ISN AND g.GNUC_Type = 'STUD' INNER JOIN sql10.ng.dbo.REGDropin ON REGT_REGH_ISN = REGD_REGH_ISN AND REGT_Student_ID = REGD_Student_ID AND REGD_Session_No = REGS_Session_NoINNER JOIN sql10.ng.dbo.RGATAttendance ON REGD_Attendance_Mark = RGAT_Attendance_Code INNER JOINsql10.ng.dbo.PRPIProvisionInstance AS pit ON pit.PRPI_Code = REGT_Provision_Code and pit.prpi_instance = REGT_Provision_Instance INNER JOIN(SELECT GNCD_General_Code, GNCD_Description FROM sql10.ng.dbo.GNCDgncodes WHERE (GNCD_Code_Type = 'M2')) AS q ON q.GNCD_General_Code = RTrim(PRPH_ML2) ENDSQL Server Agent -> Steps->DECLARE @return_value intEXEC @return_value = [dbo].[sp_WarehouseAttendance_New]SELECT 'Return Value' = @return_value

Msforeachtable

$
0
0

Is there a way to insert the output from the sp_msforeachtable proc in to a table.

the query i am trying to run is :sp_MSforeachtable 'sp_spaceused ''?'''

I tried the different variations of the insert statement as well but that didn't help as well.

Any ideas!!!

TIA

BCP produces garbled output

$
0
0
Hello,I have created a stored procedure that produces output for specific tables in our database. The output for one of the files is garbled. I have to have it fixed.The strategy I'm employing is to first create a view that contains a select statement that chooses all the fields in the table; i.e., select field1, field2, field3, etc. Then my routine calls BCP by selecting from the view. My command resembles this:bcp "select * from Database.OurSchema.BCP_View" queryout "c:\temp\bcp\MyTable.CSV" -SSQLServerName -t"|" -r"" -T -c Note: the "r" parameter is actually: -r Quote Backslash n QuoteI have been painstakingly adding one field at a time to the view until the output becomes garbled. When it does, I skip that field and try to add the one following. The same result occurs; the output is garbled.This suggests that there is a limit to the number of fields BCP can be used for. Add one more to the limit and you get junk.This table has a lot of null data. However, It is fine with null data up until it reaches the point where the data becomes garbled. Also, there is no unusual characters in string fields of this table at all.I've been searching for an option to fix this matter without success. Does anyone have an idea how to use BCP to produce non-garbled output for a table with many fields?thanks,

Use sp_MSforeachtable to gen COUNT(*) for each table in MyDBname

$
0
0

I'm trying to dynamically COUNT the # rows per table in a DB using sp_MSforeachtable. The following syntax executes DBCC CHECKTABLE for each table in my DB.

HOW can I modify the following SQL to perform a SELECT COUNT(*) from each table in my DB?

USE MyDBnameGO

sp_MSforeachtable @command1="print '?' dbcc checktable ('?')"

/* NOTE:You can issue up to three commands to the stored procedure using @command1 through @command3. */

Pros/Cons between Default vs Named Instances

$
0
0

My situation is that our network admin has come up with a new, much more complex naming convention for our company's servers. They contain dashes and the names are sometimes quite long. I am flexable enough that I can type in the extra characters, but it does cause some problems when referencing one of the servers with a funky name...but I digress. The main problem is that I feel I am ceding some control of my SQL environment to the network admin.

In the past I have always simply used a default instance of SQL because the machine name was not an issue. Now that it is, I am considering using named instances of SQL so that I have more control over my SQL environment. The challenge is that I am not familiar enough with the differences between the two. I am specifically interested in knowing if having named instances makes it harder for app developers to connect to my servers, though any and all information about this topic would help me.

Unfortunately, I don't have the resources to simply throw a named instance out there and see what happens without knowing what I'm getting myself into (otherwise I would). I have been looking around online for posts regarding and benefits or complications arising from using a named instance of SQL over the default instance, but have not found anything that satisfies my needs.

I would like some ammo to give to management that would convince them to allow me to try a named instance of a SQL server instead of using the default name like we always have. Likewise, if someone feels that I am being irrational and should just deal with it, I would like to hear your views as well.

Viewing all 482 articles
Browse latest View live