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

Foreach table in each database?

$
0
0

Hi, 

(SQL 2008R2 - enterprise)

Looking for a way of calculating table cardinality for all databases in an instance.  Is there a way of adapting this code to run against all databases?

	DECLARE @TableRowCounts TABLE ([TableName] VARCHAR(128), [RowCount] INT) ;
	INSERT INTO @TableRowCounts ([TableName], [RowCount])
	EXEC sp_MSforeachtable 'SELECT ''?'' [TableName], COUNT(*) [RowCount] FROM ?' ;

	SELECT [TableName], [RowCount]
	FROM @TableRowCounts
	ORDER BY [TableName]

I'm looking to run this job on a Sunday so I can see the actual cardinality as the estimated is way out. 

Thanks 

 


Recovery from sql server 2005

$
0
0

I am using sql server 2005.My database is increamental databse daily new tranctions are add in it.By mistake i have deleted some transaction from that database table.How can i recover it.I dont have any other database backup.plz help me.

Sql Server backup failure history

$
0
0

Hi Team,

I am using SQL 2014. I taking a backup of database using BACKUP cmd .

I found Backup failed log in applications log which not giving complete information.

I am aware, If it is a job, I will get a failed information from job history but here scenario is different. 

so how should I get the failed information ?  

SQL Server logs also giving same information which is present in Windows Application logs

DW & Link Server force query timoeout

$
0
0

Good day,

Please help, the problem I have is that users execute long running queries (20min) against prod server & Linked server

now on linked server I change the setting in Connections - Query TimeOut = 600 (10min) and the Prod Server: Allow Remote Connections to the server - remote query timeout: 600 (10min)

the opensourcequeries & SQL queries runs for 20min, results are displayed immediately but completes in 20min

I wanted to script to control queries executions but these settings don't do the trick

Please assist


MAXDOP Value SQL 2008

$
0
0

Hello Gents,

I have the following SQL 2008 x64 Clustered

  • Physical CPU 4
  • logical CPU 64

and don't know what are steps I should follow to assign the prober value , also I have researched about a way to follow but actually find all recommend to set this value based on my workload and my servers are just built and can't predicate how the workload would be.

Can not connect to SQL Server after disabling TLS 1.0 on Windows 2008 RC2

$
0
0

I'm configuring my server to accept TLS 1.1 and higher for SSL connections. When I disable TLS 1.0 on the server, however, I can no longer connect to the SQL Server 2008 instance on that server, either through a web app running on that server or using SQL Management Studio. The message is:

"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)(Microsoft SQL Server, Error: 2)

When I re-enable TLS 1.0, I can connect again.

SQL Server is not configured to force SSL, so I'm not sure what's the connection here. Any ideas what is using TLS 1.0, and how I can remove that dependency, or upgrade it to TLS 1.1 or higher? 

Thanks,
Sean

Data

$
0
0
C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA;

Here you can store data on a different computer than the one connected to it?

or an article?

How to find the database details from server audit specification with successfull login group?

$
0
0

Hi,

We have created a server audit for successfull logins.When we read the audit file using
sys.fn_get_audit_file we find that all the fields related to the databases
ie database_principal_id,database_principal_name,database_name are either 0 or null.
Is there a method to find out to which database the login is accessing from the server
audit specification of successfull login group.Although the logins are reading and writing
data to the databases why there are no details of the databases?

Thanking you in advance,

Binny Mathew


Cannot get backup script to execute

$
0
0

Im getting an error 5 Access Denied when I am trying to restore the adventureworks database in SQL Server 2014.  Here is the script:

USE [master]
RESTORE DATABASE AdventureWorks2014
FROM disk= 'C:\TestBackup\AdventureWorks2014.bak'
WITH MOVE 'AdventureWorks2014_data'
TO 'C:\Program Files\Microsoft SQL Server\MSAS12.MSSQLSERVER\OLAP\Data\AdventureWorks2014.mdf',
MOVE  'AdventureWorks2014_log'
TO 'C:\Program Files\Microsoft SQL Server\MSAS12.MSSQLSERVER\OLAP\Data\AdventureWorks2014.LDF'
How do you fix this?

Issue with linked server

$
0
0

We have created a linked server.We are getting below error when a trigger is executed from the source server.

1)OLE DB provider "SQLNCLI" for linked server "Destination server" returned message "The partner transaction manager has disabled its support for remote/network transactions."

2)Msg 7391, Level 16, State 2, Procedure trgScandetails, Line 21
The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "Destination server" was unable to begin a distributed transaction.

3)OLE DB provider "SQLNCLI" for linked server "Destination server" returned message "No transaction is active."

Please help me on this.

Thanks in advance.

Connection from Powershell to SQL using encryted connection string

$
0
0

I am writing script to connect from powershell to SQL to get data.

and I want to encryt the connection string to connect to sql server.. how can I do that ?

reducing database size/deleting file

$
0
0

let us suppose database log went full.

the transaction has to complete - but disk is full.

so I increase log space by adding another file on another disk.

transaction is done.

but now I don't want that extra space/new file anymore.

is it possible to get the log back to the original size? is it possible to remove that new file from the database?

appreciate the feedback.

Loading data from text files into SQL SERVER DATABASE

$
0
0

I have a VB0.6 application which is responsible of automatically loading text file to SQL SERVER database everyday , but this loader is too slow in loading the files , is their a way in SQL SERVER  itself to load text files without taking too much time.
taking into considerations that the size of these files is not fixed and varies between 5K to 1Gb.

thank you

powershell

$
0
0

I am just trying to understand the basics of powershell.

I saw this script to backup databases : http://blogs.technet.com/b/sql_server_isv/archive/2010/10/12/backing-up-all-sql-server-databases-using-powershell.aspx

the script from lines 4 to 6 :

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$ServerSMO = new-object ("Microsoft.SqlServer.Management.Smo.Server") $ServerName
$DatabaseList = $ServerSMO.Databases

so is $ServerSMO a pointer (in C terms) to the instance?

so having got the pointer to the instance as above, then can the database names on the instance simply be accessed from $ServerSMO.Databases?

likewise $Database.Name, $DatabaseBackup.Action etc in the script.

so it is not necessary to code any sql in powershell - but rather use properties of variables as above to access database information?

appreciate the clarification.

secpol.msc not found

$
0
0

I am using windows 8 and trying to see the password policy.

but running secpol.msc, I get the error that it doesn't exist.

any ideas what's happening?


Tune Linked Server

$
0
0

Dear Experts,

Could you please list out possible things for performance tuning of SQL server linked server.

Thanks in advance

Tuning

$
0
0

Hi! Our Navision systems has been slowing down a bit, I wanted to check if database engine health is ok.

I know in Oracle you can ran Perf Tuning utility that runs on LIVE db and and it gives you a report with all ratios , long running queries and other recommendations.

What should I use in SQL server to get such report with recommendations?


Moving to unicode datatype for an entire database - SQL Server 2012

$
0
0

Hi,

I've a SQL Server 2012 database with more tables having more char and varchar columns.

I'd like to change quickly char columns in nchar columns and varchar columns in nvarchar columns.

Is it possible to solve this issue, please? Many thanks

(SQL Server 2008 64-bit) Full-text indexing PDF not working - can't find iFilter

$
0
0
Has anyone been able to full-text index PDF documents on 64-bit SQL Server 2008 using the Adobe 64-bit PDF iFilter?

We're getting the following error in the log for any row that has a PDF document:
Warning: No appropriate filter was found during full-text index population for table or indexed view '[TestDB1].[dbo].[Documents]' (table or indexed view ID '277576027', database ID '10'), full-text key value 'D448F8EC-EB6E-4658-B9D4-CE44E7DE6552'. Some columns of the row were not indexed.

Configuration:
OS: 64-bit Windows 2008 Server R2
SQL Server: 64-bit 2008 Developer Edition SP1 + Cumulative Update 3 (Build 10.0.2723)
PDF iFilter: Adobe PDF iFilter 9 for 64-bit platforms http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025

Note that this does work correctly on 32-bit platforms (e.g. Windows XP Pro) with SQL Server 2008 at the same maintenance level (Build 10.0.2723) using the iFilter provided with the Adobe Reader 9.1. So the problem is purely related to 64-bit.

The 64-bit PDF iFilter is properly installed and shows properly in sys.fulltext_document_types. The path shown in sys.fulltext_document_types is also correct.  I.e.:

document_type class_id path version manufacturer
.pdf E8978DA6-047F-4E3D-9C78-CDBE46041603 C:\Program Files\Adobe\Adobe PDF iFilter 9 for 64-bit platforms\bin\PDFFilter.dll 9.0.0.0 Adobe Systems, Inc.

There is a KB article (http://support.microsoft.com/kb/972650) that deals with an issue related to iFilters. However,
1. the KB doesn't mention Windows Server 2008 nor 32-bit/64-bit
2. The fix is in CU6 (pre-SP1) but not in CU3 (post-SP1)
3. The path that SQL Server shows to the iFilter is correct on both 32-bit and 64-bit version of my SQL Server 2008
4. I've confirmed that the problem doesn't exist on 32-bit OSs at CU3.

Collation problem with new instance

$
0
0

A client
has moved a database from a SQL 2005 instance to a 2012 Instance <o:p></o:p>

Now running some TSQL I get 'Cannot resolve the collation conflict between SQL_Latin1_General_CP1_CI_AS and Latin1_General_CI_AS In the equal to operation '<o:p></o:p>

I have checked the database and the collation is ‘SQL_Latin1_General_CP1_CI_AS’
whereas the master database’s collation is Latin1_General_CI_AS<o:p></o:p>

Having read
other posts on collation it looks to me that I am going to have to change my
database and columns to Latin1_General_CI_AS, <o:p></o:p>

Is this
assumption correct and is it possible to change it in the management studio or
do I have to alter every text column in every table using TSQL<o:p></o:p>

I have seen
this example but don’t want to run it untried<o:p></o:p>

http://stackoverflow.com/questions/18122773/change-collate-of-all-columns-of-all-tables-in-sql-server<o:p></o:p>

unfortunately
time is not on my side<o:p></o:p>



jnc

Viewing all 12963 articles
Browse latest View live


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