Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

Problem to restore it

$
0
0
Hi,
I backup the original schema that is called "SCH" and have created .bak file.

Then I create SCH2 schema and select the relevant .bak to restore it into the new schema. But I get these

TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore failed for Server 'MYDB'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.5000.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'SCH2' database. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.5000.00&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------



why?

Many Thanks & Best Regards, Hua Min


Change SQL file Location

$
0
0

Hi DBA's

We have a SQL server Installed on Windows folder(Someone by mistakenly configured into C drive which is having all the data/log/backup folders), would it be possible to change all the data and log files (which already existed) into other drive location.

If it's possible Please explain the pros and cons

Thanks all.


DBA

Please interpret the DBCC CHECKDB output and suggest how much my db is corrupt

$
0
0

Hi All,

DBCC CHECKDB on my database in simple recovery model failed. Please find the error message below. I copied the backup and restored on a test server and ran DBCC CHECKDB with repair_allow_data_loss. Below bold lines was the one got repaired. Does ths caused any loss of user data. Kindly suggest.

 Repair: The Clustered index successfully rebuilt for the object "sys.sysobjvalues" in database "****".

Repair: The page (1:629823) has been deallocated from object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data).


Executing the query "DBCC CHECKDB(N'****') WITH NO_INFOMSGS

" failed with the following error: "Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID -3212797581117423616 (type Unknown), page (40634:1181196049). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 12716041 and -4.

Incorrect PFS free space information for page (1:160) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 95_PCT_FULL, actual value 50_PCT_FULL.

Incorrect PFS free space information for page (1:3427) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 80_PCT_FULL, actual value 95_PCT_FULL.

Incorrect PFS free space information for page (1:22426) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 100_PCT_FULL, actual value 50_PCT_FULL.

Incorrect PFS free space information for page (1:26439) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 50_PCT_FULL, actual value 100_PCT_FULL.

Incorrect PFS free space information for page (1:27700) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 95_PCT_FULL, actual value 100_PCT_FULL.

Incorrect PFS free space information for page (1:27701) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 80_PCT_FULL, actual value 95_PCT_FULL.

Object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data): Page (1:629823)could not be processed. See other errors for details.

CHECKDB found 0 allocation errors and 1 consistency errors not associated with any single object.

CHECKDB found 0 allocation errors and 7 consistency errors in table 'sys.sysobjvalues' (object ID 60).

CHECKDB found 0 allocation errors and 8 consistency errors in database '****'.

repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (****).

Thanks Lakshmana Y

Power Plan Setting change on SQL Server

$
0
0

Hi Experts,

Currently our SQL server is running on Power Plan setting with "Balanced" mode and would like to change to "HighlyOptimized" mode. I would to know the benfits and dis-advantage of doing this expercise. I would like to know the details like how much time SQL server takes to change the setting or is there any impact of running transaction we if we change it on week days.

if you can guide me according that would be great help to me.


Shivraj Patil.

Defragging database on SAN storage

$
0
0

Hello

We have a 4TB SQL 2005 database which has a MDF and LDF file on SAN storage. 

We have a defragging sql job which takes 8-9 hours.

I have read several posts which says if the database is on SAN we don't have to worry about defragmentation as SAN data storage is random.

Is this true? Can we disable the job?

TIA


Cross Database Ownership Chaining fails: The SELECT permission was denied on the object on the 3rd database

$
0
0

I have three databases, DB1DB2 and DB3 on one server and I enabled the cross database chaining at the server level. I have a login, say login1, on DB1 can access all the views.

use DB1
gocreateview V1 asselect*from DB2.dbo.Table1
gocreateview V2 asselect*from DB2.dbo.View1-- DB2.dbo.View1 is defined as create view View1 as select * from DB3.dbo.SomeTable

All the objects have owner of dbo. Now login as login1, select * from Db1.dbo.V1 works. However,select * from Db1.dbo.V2 failed with message

The SELECT permission was denied on the object 'SomeTable', database 'DB3', schema 'dbo'.

INSERT ... EXECUTE - How to add additional data

$
0
0

Hi community,

I have a SQL that consolidates blocks of records with into a larger records. These rows are inserted into a new database. The consolidation is rather complex. So I wrote a CLR Stored Procedure to consolidate these blocks. The new rows contain more columns. Many of them contain the consolidated data from these blocks. The CLR SP return a row into an INSERT ... EXECUTE. pls. refer to the code shown.

To avoid channeling additional column data thru the Stored Procedure I would like to INSERT some data after the SP has returned. Is there any coding to add value for additional columns with the INSERT ... EXEC? Or would you solve a task totally different?

Many thanks in advance!

WHILE @@fetch_status = 0
BEGIN
	SET @AnlagenschlüsselLast = @Anlagenschlüssel
	SET @Count = 0
	BEGIN TRY
			INSERT INTO dbo.pamSQLFinalWind (
			Anlagenschlüssel, [Originating ÜNB], [Abrechnungsjahr], [Energie kWh], [EEG Subvention EUR])
			EXECUTE dbo.pamEEGDecomposition @Anlagenschlüssel, @ÜNB, @Abrechnungsjahr,  @COUNT OUTPUT;
	END TRY
	BEGIN CATCH
		INSERT INTO dbo.pamSQLFinalWindErrors (
			Anlagenschlüssel, [Originating ÜNB], Nummer, Severity, [Stored Procedure], Zeile, Fehlerbeschreibung)
			VALUES (@AnlagenschlüsselLast, @ÜNB, ERROR_NUMBER(), ERROR_SEVERITY(), ERROR_PROCEDURE(), ERROR_LINE(), ERROR_MESSAGE());
	END CATCH
	FETCH RELATIVE @Count FROM Cursor_Anlagenschlüssel INTO @Anlagenschlüssel, @Menge, @Subvention, @ÜNB
	SET @TotalCount += @Count
	SET @BatchCount += 1;
END


Regards Uwe

sp_who2 shows cpu=2147483647

$
0
0

Wassup with this?  Just started a big insert statement, server with four cores, sp_who2 shows 25 lines for spid #61, ok I have a parallel plan, but 24 of the lines shows cpu=2147483647.

This is on version:

Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)
Mar 29 2009 10:11:52
Copyright (c) 1988-2008 Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 5.2 <X64> (Build 3790: Service Pack 2)

only unusual thing I can think of is the database is still in compatability mode 90 (SQL2005), not sure why.

Activity monitor never showed the CPU as above about 40%.

Thanx.

Josh

 


Slow plan generation with Clustered Columnstore Index

$
0
0

We have a table with built with a clustered columnstore index.

The table has 5+ billion rows.

The table is partitioned by date. 

We have noticed that generating a query plan can take 4+ minutes. Most of the time it takes at least 1 min. 

Once the plan is created, it is usually < 10 seconds to get the plan. 

SQL Server is running on a 64 core 2012 R2 server w/ 1.2 TB of RAM and direct attached storage. SQL is 2014 CU 4 Ent.

Is this expected? The table is not joined with other tables.

Thank you

Problem to the line

$
0
0
Hi,
How to correct the last exec line below
declare @objcursor as cursor
declare
	@iteStatus nvarchar(2),
	@ite2tatus nvarchar(2),
	@vsql nvarchar(max),
	@vquery nvarchar(max),
	@unit nvarchar(10),
	@featNo nvarchar(10)

	set @vquery = 'select c.iteStatus,c.ite2tatus,c.unit,c.featNo from '+@tab_nm+' i,obj2 a,objs c where isnull(i.EVENT_TYPE,'''') '+'in(''A'',''D'',''M'') and isnull(i.UPDATE_STATUS,'''')=''R'' and i.obj_UNIT=a.Unit and i.obj2No=a.obj2No '+'and a.UNIT=c.Unit and a.featNo=c.featNo order by i.EVENT_TIMESTAMP'
	set @vsql = 'set @cursor = cursor forward_only static for ' + @vquery + ' open @cursor;'

	exec sys.sp_executesql
		@vsql
		,N'@cursor cursor output'
		,@objcursor output
		...



due to this error?
Msg 16950, Level 16, State 2, Procedure p_upd_cust_status, Line 22
The variable '@objcursor' does not currently have a cursor allocated to it.



Many Thanks & Best Regards, Hua Min

Hung log backup jobs on SQL 2012 installed on Windows 2012

$
0
0
We are facing issues with log backups on SQL 2012 SP1/SP2 on Windows 2012 Standard edition. The log backups are hanging most of the time which is making the whole Scheduler hung. When we restart the SQL Services, the log backup run for some time and then they hang randomly. This is only happening on SQL 2012 on Windows 2012 Standard edition servers. Has anyone encountered this issue?

Monitor Transactions Per second

$
0
0

Some times I see my SQL Server is running less than 2000 Transactions per second (from the "Transactions /sec" Perfmon counter) and some times I see there are 17000 Transactions per second.

If I want to find out which application is executing these transactions or which query is executing these transactions, is there a way to find this out?


Suddenly database IO(40 MB/sec) going very high

$
0
0

Hello Everyone,

One of our organization SQL server  database IO(40 MB/sec) going very high without any changes in database, past few days everything working fine but now getting in problem and wait type gettingIO_COMPLETION in every running task..

getting any problem if 2 network card bridging or timing at OS level...

its very tedious job to identify.

Plz suggest me to resolve my problem.....

thanks in advance

SQL Server memory utilization in 2005

$
0
0

Hi,

We have SQL Server 2005 instance which is having max server memory configured to 20GB, how to find how much memory it is using out of 20GB, I tired below:

--giving constant value all the time

SELECT object_name, counter_name, cntr_value AS 'Total Server Memory (KB)'
FROM sys.dm_os_performance_counters 
WHERE counter_name = 'Total Server Memory (KB)'

--This is working fine in 2008 but not in 2005, as this is introduced from 2008 on wards 

SELECT
(physical_memory_in_use_kb/1024) AS Memory_usedby_Sqlserver_MB,
(locked_page_allocations_kb/1024) AS Locked_pages_used_Sqlserver_MB,
(total_virtual_address_space_kb/1024) AS Total_VAS_in_MB,
process_physical_memory_low,
process_virtual_memory_low
FROM sys.dm_os_process_memory

Please help, thanks in advance.

BKR


BKR

Maintenance Plan Original name of DB change

$
0
0

Hello,

Sorry if is not the topic for this case.

I have a Maintenance Plan that do the Full Backup of 10 data bases.

On 3 data base, i have a problem, when i try to restore from the file .bak, the "Original Name" shows without the last letter.

I explain the process:

1- On a test data base from SQL Server Managment Studio -> Tasks -> Restore -> Database.
2- From Device -> I select the file .bak of the database.

3- I select this backup, and then go to "Options", the name in the field "Original File Name" is different of the Original Data Base Name.

This happens in 3 data base for the same maintenance plan. For the others 7 data base shows the name correct.

Anyone know this problem ? What happens ?

I searched online but found nothing.

Thank you in advance.

Regards,


Couldn't send an email to hotmail

$
0
0

Hi Everyone,

I'm trying to send an email from DBmail to hotmail but, i am not able to receive any email from the server to hotmail account. Whats the problem in the process of the DBMailConfiguration.

Anyone help me.

Error: 824, severity: 24, state: 7

$
0
0

Hi!
We are having trouble with reccuring 824 error message. I run dbcc checkdb on all databases. This reports that every thing is fine. The server has 2 instances and only one is giving the error. The server is running VMware and VMWare tools 9.0.11. I can't find any additional information in the event log. suspect_pages table is empty for both instances. The instance that works runs a sharepoint database, the instance that fails run a TFS database.

My understanding is that SQL Server is doing a windows API call to perform the I/O operation. Then SQL Server checks if there was any error condition with these calls, if they fail with an operating system error then SQL Server reports and 823 error. If the windows API call succedes but the data transferred by the I/O operation encountered a logical consistency problem this is reported as an 824 error.

How to debug and fix this error?

SQL 2012 Memory usage analysis

$
0
0

We have this clustered SQL Server, win 2008 R2 + SQL 2012 Standard SP2,

Server RAM is 64GB, maximum memory is set at 50GB, and minimum memory is set at 10GB.

When I check memory usage, it seemsCLR takes more memory than Buffer Pool, is it normal? Or does it show memory allocation issue? Thanks a lot!

The "total server memory" and "target server memory" performance counters are both 50GB.

Please kindly see below screen shots below:


BI Server on 2014, while Database Engine server on 2008

$
0
0

We would be happy to upgrade our SQL Server environments to 2014, but we have a tight budget for next year.

Our BI server is located separately from the database server and contains our SSIS and SSRS packages and reports.

I was wandering whether it's possible to have a configuration where the BI server will have SQL Server 2014 (Standard of Business Intelligence) but the database server itself will remain on 2008.

Thanks for your answers,

Roni.

Localhost is not connecting

$
0
0

Hi All,

I am Norbert. I had installed SQL Server on my Windows 7 system. Everything went right. SQL server management studio has been installed. When i click to open , its opening and ask for DB Connection.

Whatever i give it just shows a Error message, Kindly please find the image.

Please do the needful.Error Showing While opening My Database

Viewing all 12963 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>