Quantcast
Channel: SQL Server Database Engine Forum
Viewing all 15872 articles
Browse latest View live

Msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal, Line 607

$
0
0

I am trying to enable cdc on one of my tables, and I get the following error and nothing I have found seems to work,

Msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal, Line 607
Could not update the metadata that indicates table [dbo].[Client_Types] is enabled for Change Data Capture. The failure occurred when executing the command 'insert into [cdc].[change_tables]'. The error returned was 515: 'Cannot insert the value NULL into column 'has_drop_pending', table 'BillingDb.cdc.change_tables'; column does not allow nulls. INSERT fails.'. Use the action and error to determine the cause of the failure and resubmit the request.

I am running SQL 2008 SP3 with .Net 4.5, and here is the cmmands I am running.

EXECUTE sys.sp_cdc_enable_table @source_sehema = N'dbo', @source_name = N'Client_type', @role = NULL

Any ideas?


Database size versus table data size

$
0
0

I ran the below query that queries all tables in the database and the total size for reserved space is 17GB. The database size is 294GB. Why is there such a big difference in size. I would expect the database to be a little bigger but not 277GB bigger.

DECLARE @TableName VARCHAR(100)    --For storing values in the cursor
--Cursor to get the name of all user tables from the sysobjects listing
DECLARE tableCursor CURSOR FOR  
select [name] from dbo.sysobjects  where  OBJECTPROPERTY(id, N'IsUserTable') = 1 FOR READ ONLY
--A procedure level temp table to store the results
CREATE TABLE #TempTable (     tableName varchar(100),     numberofRows varchar(100),     reservedSize varchar(50),     dataSize varchar(50),     indexSize varchar(50),     unusedSize varchar(50) )
--Open the cursor
OPEN tableCursor
--Get the first table name from the cursor
FETCH NEXT FROM tableCursor INTO @TableName
--Loop until the cursor was not able to fetch
WHILE (@@Fetch_Status >= 0) BEGIN     
--Dump the results of the sp_spaceused query to the temp table     
INSERT  #TempTable         
EXEC sp_spaceused @TableName     
--Get the next table name     
FETCH NEXT FROM tableCursor INTO @TableName END
--Get rid of the cursor
CLOSE tableCursor
DEALLOCATE tableCursor
--Select all records so we can use the reults
SELECT *  FROM #TempTable
order by 2
--Final cleanup!
DROP TABLE #TempTable


Alan

SQL Lite Speed by DELL or Idera SQL Safe

$
0
0
We have about 80 SQL servers that we manage backups for. Some of our largest DB's are as big as 10 TB.
 

What you think is better option SQL Lite Speed by DELL or Idera SQL Safe and where can I find the info to compare the products?

Thanks everyone for the feedback!

high T-log Size

$
0
0

Hi,

I have a a database of 100Gigs and a t-log of 300GB. The database is scheduled for t-log backup every one hour and differential every day.

1.I increasted the t-log backup frequency-But there is no change in file size even after shrink

2.T-log has 3 files.other two files has just 10Gb each.What would be the reason?

Regards,

Arun


Best Regards, Arun http://whynotsql.blogspot.com/

Lock Statistics

$
0
0

Hi All,

Is there in SQL Server to lock statistics on tables similar to Oracle LOCK Statistics ?

File name in msdb.dbo.backupset no longer matches the actual file name on the storage media. Error 3013 Restore Database is terminating abnormally.

$
0
0

Thanks in advance for taking the time to read this and comment. Platform: Windows Server 2008 R2 Enterprise Edition SP1 (X64) Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) Jun 17 2011 00:54:03 Copyright (c) Microsoft Corporation
 Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)Problem Description: The file name recorded in the msdb.dbo.backupset (sans the extension) no longer matches the actual file name written to the backup media which is in this case a NETAPP NAS storage share. Example:

Mohave_backup_2014_03_14_233001_1158878.bak      (from NETAPP NAS filer)
Mohave_backup_2014_03_16_233001_4167237             (from MSDB.dbo.backupset), as you can see, the last 7 digits (chars) of the file name are different, although the date and time are identical. The file names had previously been matching perfectly. The first occurance of this problem occured on 03/13/2014 at 5:00 AM MST. The error generated by the job was:

Date  3/14/2014 10:29:23 AM
Log  Job History (Refresh - Restore Mohave_93_DEV AD HOC)

Step ID  1
Server  OurDevServer
Job Name  Refresh - Restore Mohave_93_DEV AD HOC
Step Name  Restore Mohave_93_DEV
Duration  00:00:01
Sql Severity  0
Sql Message ID  50000
Operator Emailed  
Operator Net sent  
Operator Paged  
Retries Attempted  0

Message
Executed as user: OurDomain\OurNetworkServiceLogin. Restore Mohave Prod to Mohave_93_DEV - ERROR: 3013 RESTORE DATABASE is terminating abnormally. [SQLSTATE 01000] (Message 50000).  The step succeeded.

17 GB of data but database is 290GB WHY????

$
0
0

I ran the below query and it came up with 17GB of data. My database is 290GB. This doesn't make sense. I know because of all the other object of course it would be bigger but not that much bigger. Does anyone have an answer? And please don't say SP's, trigger,s views etc. That doesn't make up 275 GB of data.

DECLARE @TableName VARCHAR(100)    --For storing values in the cursor
--Cursor to get the name of all user tables from the sysobjects listing
DECLARE tableCursor CURSOR FOR  
select [name] from dbo.sysobjects  where  OBJECTPROPERTY(id, N'IsUserTable') = 1 FOR READ ONLY
--A procedure level temp table to store the results
CREATE TABLE #TempTable (     tableName varchar(100),     numberofRows varchar(100),     reservedSize varchar(50),     dataSize varchar(50),     indexSize varchar(50),     unusedSize varchar(50) )
--Open the cursor
OPEN tableCursor
--Get the first table name from the cursor
FETCH NEXT FROM tableCursor INTO @TableName
--Loop until the cursor was not able to fetch
WHILE (@@Fetch_Status >= 0) BEGIN     
--Dump the results of the sp_spaceused query to the temp table     
INSERT  #TempTable         
EXEC sp_spaceused @TableName     
--Get the next table name     
FETCH NEXT FROM tableCursor INTO @TableName END
--Get rid of the cursor
CLOSE tableCursor
DEALLOCATE tableCursor
--Select all records so we can use the reults
SELECT *  FROM #TempTable
order by 2
--Final cleanup!
DROP TABLE #TempTable
GO


Alan

Backup Retention period setting in SQL Server 7

$
0
0

Hi,

    Can anyone help me out, how to setup retention period for backup in SQL server 7?


Problem with the connection

$
0
0

Hi,

I do encounter this error

 
OLE DB provider "OraOLEDB.Oracle" for linked server "ORA_CONN" returned message "ORA-12518: TNS:listener could not hand off client connection".

Msg 7303, Level 16, State 1, Line 2

Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "ORA_CONN".

 

on the connection, on which I have a linked server, within Sql server, pointing to Oracle DB. How to resolve this?


Many Thanks & Best Regards, Hua Min

You can be our next Spring SS DBE Guru !!

$
0
0



In the northern hemisphere at least, Spring is here! (apparently)

And at TechNet Wiki, we're hoping you're all hatching new ideas for this month's TechNet Guru competition!

We're looking for more shoots and leaves of wisdom to sprout forth from the great tree of MSDN/TechNet life.

We're also hoping some of our old Guru winners will be coming back out of hibernation and flexing their grey matter!

So, pick up your pen and MARCH into TechNet History! This could truly be the start of something BEAUTIFUL!

What delightful new arrival will YOU be bringing into this world?

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day's work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations toTechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you've contributed)

3) Every month, we will highlight your contributions, and select a "Guru of the Month" in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once "on our radar" and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

Feel free to ask any questions below.

More about TechNet Guru Awards

Thanks in advance!
Pete Laker


#PEJL

Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to the one and onlyTechNet Wiki, for future generations to benefit from! You'll never get archived again!

If you are a member of any user groups, please make sure you list them in the Microsoft User Groups Portal. Microsoft are trying to help promote your groups, and collating them here is the first step.

Find out any codes doing the insert

$
0
0
Hi,
Is there one way to find out, if there are any codes/process within the relevant schema, which are doing any insert into one specific table?

Many Thanks & Best Regards, Hua Min

error message when trying to create any query

$
0
0
 

I am trying to run a query on my sql server and get the following error message:

 

"An error occurred while executing batch. Error message is: The directory name is invalid."

 

how do I fix?

PowerShell - scripting - skip Encrypted\CLR Stored Procedures

$
0
0

Hi all,

Forgot where I got the code below from but, how would I skip Encrypted\CLR procedures because, I get error below...

Message
Executed as user: Loginname A job step received an error at line 81 in a PowerShell script. The corresponding line is '$MyScripter.Script($proc)|out-null'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Exception calling "Script" with "1" argument(s): "The StoredProcedure '[dbo].[myrpocname]' cannot be scripted as its data is not accessible."  '.  Process Exit Code -1.  The step failed.


#STORED PROCEDURES
if($procs -ne $null)
{
	foreach ($proc in $procs)
	{
		#Assuming that all non-system stored procs have proper naming convention and don''t use prefixes like "sp_"
		if ( $proc.Name.IndexOf("sp_") -eq -1 -and $proc.Name.IndexOf("xp_") -eq -1  -and $proc.Name.IndexOf("dt_") -eq -1)
		{
			$fileName = $proc.name"Scripting SP $fileName"
			$scriptfile = "$rootDrive\DatabaseScripts\$sqlDatabaseName\$strDate\StoredProcedures\$filename.sql"
			New-Item $rootDrive\DatabaseScripts -type directory -force | out-null
			New-Item $rootDrive\DatabaseScripts\$sqlDatabaseName -type directory -force | out-null
			New-Item $rootDrive\DatabaseScripts\$sqlDatabaseName\$strDate -type directory -force | out-null
			New-Item $rootDrive\DatabaseScripts\$sqlDatabaseName\$strDate\StoredProcedures -type directory -force | out-null
			# SetScriptOptions
			$MyScripter.Options.FileName = $scriptfile
			#AppendTofile has to be ''true'' in order that all the procs'' scripts will be appended at the end
			$MyScripter.Options.AppendToFile = "true"
			$MyScripter.Script($proc)|out-null
		}
	} 

Thanks

gv


Sword

Multi server administration MSXOeprator not getting notified via email

$
0
0

I created mutli server jobs and they are working fine except that I don't get any notification via email.

The target and master are configured with DB Mail and it is working fine. But for the multi server jobs.. it isn't.

I tried the operator that exists in both target and master and also the msxoperator.

What am I doing wrong?

Thanks


Paula

SQL Server Resource Governor

$
0
0

We have a SQL Server with about 15 databases and about 60 + users accessing any of these databases. Each database is designed to serve different data set (meaning - we have multiple roles in each database). one user can access as many as all database (1 or 2 or any number upto 15). Users typically run the workflows which includes access to multiple databases usually 3-4 databases at a time. During peak time multiple users run similar workflows accessing many databases.

Out of 15 databases, we have 5 databases with heavy load, for rest of them it is nominal load.

Recently we started experiencing high CPU and memory issues on this server and we are planing to implement SQL Server Resource governor.

Below is my requirement (and questions) for SQL Server Resource Governor : 1. I like to restrict any single user take more CPU (let say more than 60%) at any time.

  1. If I put users in a single resourse group based on database or role - how that will impact other users in the same group. For example - if we have 3 users in a group and user-1 started the process and it max out the CPU for that group and when other users start their own process - what will be the impact?

  2. Is is better to configure based on : a. per database b. per role c. per user d. any other suggestion?

  3. Can anyone provide a typical approach for the following case: 3 users have access to 3 databases and they all are heavy users and runs jobs at the same time - what is the best way to configure this scenario.

Any suggestions are welcome also let me know if you need any other information to answer in better manner.

I like to understand - if we put multiple users on the single resource group - how memory and CPU will be allocated within them. For example if one user in resouce group start a heavy workflow and takes about max cpu and then other users (let say 5 other users) starts their processes - 1. will they be able to run queries ? 2. How memory / CPU will be allocated between each users in the resource group (here between 6 users).


Antivirus and SQL -- "to do or not todo"?

$
0
0

I was reading through  http://support.microsoft.com/kb/309422/en-us

and plan to adopt its suggestions NOT to AV scan certain file SQL (2008) file extensions:

>>>>>>>>>

mdf, ldf, ndf

.bak, .trn

.sql

 Full Text Catalogs

>>>>>>>>>>

Per the URL "we strongly recommend that you individually assess the security risk for each computer...." I suspect the risk is generally small and, from a performance, perspective prefer not to AV scan them (realtime or otherwise) on any of our sql servers.  What are your thoughts on this?

TIA,

edm2

Linked Server Error from SQL2008R2 to SQL2000

$
0
0

I am trying to Execute Query/SP from my local machine which SQL 2008R2 To SQL 2000 32 bit. 

Created Linked Server from Local machine to SQL2000 Machine..

Query /SP run fine from SSMS but when I am trying to run through this below script keep giving me error .

I converted Select query into SP 

 EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'SQL-MailAlerts',
    @recipients = '**********',
    @query = 'EXEC dbo.QueryResult',
    @query_attachment_filename = 'result.csv',
    @attach_query_result_as_file = 1,
    @body_format = 'text' ;

Error :

Msg 22050, Level 16, State 1, Line 0
Error formatting query, probably invalid parameters

Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 504

Linked servers cannot be used under impersonation without a mapping for the impersonated login.

Basically trying to get Query result from SQL 2000 Database into mail if anyone has better idea let me know.

Thanks


Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

MSSQL 2008 R2 - 32bit, TSQL backup with compression, error: There is insufficient system memory in resource pool 'internal' to run this query

$
0
0

Hello,

I would like to ask you about advice.

We have MSSQL 2008 R2, 32 bit. Memory is 4GB, split into 2GB for Windows and 2GB for applications. Database has recovery model simple because we have replicated data into other servers ( 2 ). Contemporary we work with 2 servers. Max memory for MSSQL is 2048 MB.

We set thebackupas follows:

USE MSDB
GO

DECLARE @JMENO_ZALOHY VARCHAR(120)
SELECT  @JMENO_ZALOHY = 'E:\backup\BackupSQL\1 Pondeli\DAVOSAM_'+ convert( varchar(2), datepart( hh, getdate() ) ) + '00_DEN_DIFF.bak'
SELECT  @JMENO_ZALOHY

BACKUP DATABASE [DAVOSAM]
TO DISK = @JMENO_ZALOHY
WITH INIT, DIFFERENTIAL, CHECKSUM, COMPRESSION
GO

Every second or third day in log there is error message: 'There is insufficient system memory in resource pool 'internal' to run this query' Accurate in time of backup. The error is still repeat, majority in working hours.

Today I have found out, that problem is probably in compression of backup. Because if I removed word: compression, a backup normally runs without error.

Question: Is my hypothesis correct that problem is in backup with compression?

Thank you David

SQL Server selection of a particular index

$
0
0

Hi,

I am still puzzled on how a particular index is being selected in SQL Server. This is especially for non-clustered index. It seemed that the selection of the INDEX columns and INCLUDE columns in the create index statement have an impact in the selection of the index being used.

Is there any reference to the algorithm that SQL Server use in the selection of non-clustered indexed?

Thanks

How best to reorganioze SQL Server database

$
0
0

My largest database has grown to 1.4 terabytes and need to be restructured because of I/O performance issues.

The data was originally spread out across 4/ 250 GB LUNS and have now grown to 6 files of various LUN sizes. 

We need to add additional space, since purging data is very political and no agreement is in sight. We do not wish to keep adding files but would rather create larger LUNS to combine some files, is this good idea?

How have you dealt with the growth of your data? I will have only a few hours outage to complete the reorg.

OS Windows 2008 R2 SP1

SQL Server 2008 Enterprise SP2

Cluster

Viewing all 15872 articles
Browse latest View live


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