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

Create clustered index with drop existing completed too quickly

$
0
0

I am trying to move all tables  on my SQL Server 2008 R2 database from Primary file group to FG1.

I executed below script on all tables.

Create Unique Clustered Index [MyTable_id_pk] On [dbo].[MyTable] ([MyTable_id] Asc)  With (Drop_Existing = ON, SORT_IN_TEMPDB = ON, Fillfactor = 100, PAD_INDEX = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, DATA_COMPRESSION = NONE) 
On [FG1];
GO

The database is about 500 GB and these tables have millions of rows. Yet the whole  Create clustered index with drop existing code on tables executed under 8 minutes.

How do I verify if it has really moved any data out to FG1?




Ravi Kumar


SQL Agent - Error Authenticating Proxy

$
0
0

I am having an issue when scheduling an SSIS package on a Production environment (via SQL Agent, utilizing a Credential/Proxy). I have worked through the steps below in a Test environment and have not had any problems. Here's what I've done in Production (on a SQL Server 2008 R2 non-clustered environment):

- Copied SSIS package to file system (NTFS permissions are set properly)

- Created a Credential and Proxy (for a Windows user)

- Created SQL Agent job to execute the SSIS package

- Executed the job and receive the following error: 

"Unable to start execution of step 1 (reason: Error authenticating proxy DOMAIN/user, system error: Logon failure: unknown user name or bad password.).  The step failed."

Can someone help me work through this? I have tested the process above with a blank SSIS package, so I know it has nothing to do with access to the source systems. The issue resides specifically on the SQL Server box that is running SSIS and SQL Agent.

I have done some reading and found the following:

- Delegate permissions to SQL Agent account...

- Provide "Log on as a batch job" permissions to AD user

- Install a KB to fix...

Not sure what to puruse at this point. Also, the Job will run just fine using the SQL Agent service account; however, I need to run this user as a different account.

Please advise.


Delete Backup History: Internal Query Processor Error

$
0
0

I was attempting to cleanup backup history, but in doing so I get an error

I ran "exec sp_delete_backuphistory '9/1/2014'" and received the error

Msg 8630, Level 16, State 1, Procedure sp_delete_backuphistory, Line 59

Internal Query Processor Error: The query processor encountered an unexpected error during execution (HRESULT = 0x80040e19).



Lee

Accessing SQL Server over network 100 times slower than local!

$
0
0

I have a C# application developed on a Windows 7 system with a local SQL Server Express database.  The application uses a combination of Entity Framework, LINQ, and T-SQL. Performance in the development environment is great. I recently deployed the application to a new Windows 7 client on a gigabit network connected to a SQL Server 2014 instance running on a Windows Server with tons of disk and RAM. In the network environment, all access to the database is running roughly 100 times slower than the development environment.  I also installed the application on the server itself to test whether the database had an issue, but it was screaming fast on the server - even faster than on the development system. I added the following function to my application to do some testing:

			Stopwatch MyTimer = new Stopwatch();

			MyTimer.Start();

			string connString = GetData.GetConnectionStringByName("MyDB");
			string Query = "INSERT INTO dva.JobHistories (DataSetDSId, EstabName, JobOpenings, JobsFilled) ";
			Query += "VALUES (1, 'Headquarters', 2039, 72)";

			// Connect to the database:
			using (SqlConnection myConnection = new SqlConnection(connString))
			{
				// Open the connection:
				try
				{
					myConnection.Open();
				}
				catch (Exception ex)
				{
					Console.WriteLine(ex.ToString());
				}

				// Execute query and read any results:
				SqlCommand command = new SqlCommand(Query, myConnection);

				// Beginning of timed code:

				for (int i = 0; i < 500; i++)
				{
					command.ExecuteNonQuery();
				}

			// Ending of timed code:
			}

			MyTimer.Stop();
			TimeSpan ts = MyTimer.Elapsed;

			string NiceElapsed = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
				ts.Hours, ts.Minutes, ts.Seconds,
				ts.Milliseconds / 10);

			System.Windows.Forms.MessageBox.Show(NiceElapsed);

When executed on the server, this takes about 0.3 seconds to complete. Executed on the Windows 7 client, over the network, this takes about 100 seconds to complete. This is consistent with other database access done in the application. I have done similar tests in SQL Server Management Studio on the server and on the client with similar results.

I temporarily disabled Trend Micro on both the client and server with no change in performance.

I understand there should be some network latency added, but this is ridiculous. The application is unusable at this point. Before I go to the network admin, I wanted to check if there were some obvious things that would cause this that I can look into and fix.

Auditing disable

$
0
0

Hi,

We are running SQL Server 2012. I need below answers raised by our auditing.

In our production system, auditing is disabled on DB and server level. 

1. What are the pros and cons of auditing?

2.  cross database ownership chaining is enabled on master, tempdb, and msdb databases

3.xp_cmdshell  is enabled, should it be like this or should it be disabled?

REgards




Unable to Connect to SQL 2000 Instance from Windows Server 2012 environment

$
0
0

We have a windows server (TEST) 2012 environment , where our test SQL Server 2012 instance is hosted.

We have a different (DEV) Server (windows 2000)  where a SQL Server 2000 instance is present.

When I RDP to our Windows Server 2012 box, I cannot connect to the SQL 2000 server instance from SQL Management Studio. (whereas I can connect to the same server from my local machine which has windows 7 and SQL 2012 installed). 

This is the error i see - 

"A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (.Net SqlClient Data Provider)"

 

When run from SQL Agent Service from TEST (A Job which tries to connect to that SQL 2000 instance to read some data using SSIS) , we get the following error - 

An OLE DB record is available.  Source: "Microsoft OLE DB Provider for SQL Server"  Hresult: 0x80004005  Description: "[DBNETLIB][ConnectionRead (recv()).]General network error. Check your network documentation.".

----------------------------

The same SSIS package runs successfully from my local machine.

Please, could someone advice how to resolve this situation?

 


NT Authority\System vs Localsystem

$
0
0
Hi all, what's the difference between NT Authority\System   vs   Localsystem??

what's the difference using NT Authority\System   vs   Localsystem to start SQL server services??

Encrypt and Decrypt Card Number using AES 256 algorithm

$
0
0

Dear All,

     I have a table in Sql Server database. in that table  storingCard_Information. This information is secured so that need to encrypt that data in sql server table.

Can some one help on Encrypting and decryption process using AES 256 algorithm.


Regards, Praveen


SSPI handshake failed with error code 0x8009030c, state 14 - Machine Account Replication?

$
0
0

Hi. I am using the multi server admin feature. I have many SQL Servers as targets. Some of these are using service SIDs for the agent service account. When using a service SID, the master server must grant access to the target machine account rather than the agent service account.  All works well for the most part.  However, once in a while there is a period of 10-15 minutes of handshake errors on the master server from a single target.  In the last set of errors, I noticed that there was a machine account password reset just before the errors. 

The system successfully changed its password on the domain controller \\xxxxxxxxxxxx.  This event is logged when the password for the computer account is changed by the system. It is logged on the computer that changed the password.

I'm thinking that the handshake errors are because the machine password change has not replicated yet.  Any advice?  Perhaps I have to use domain service accounts in all cases? 

Thanks.


Randy in Marin

will MS please change sys.sp_addlinkedsrvlogin to allow ACTIVE DIRECTORY GROUP LOGINS?

$
0
0
We have a need to set permissions to linked servers to other data stores (Teradata/db2, etc) to allow BATCH IDS to run processes that need some data. However we don't want any user (John Q User) that is logged on to the SQL server to see the unmasked confidential data. We thought the best way is to add a linked server login to the same linked servers to an "unmasked data" ID for the DBA AD group, and all else would have the "masked data" ID. However...sp_addlinkedsrvlogin only allows U types from sys.server_principles. Could this code (starting on line 62) be modified to also include 'G'? If Microsoft cant' do this, why not? Also can we emulate this procedure and write a custom proc that will accomplish the same thing?  

if (@locallogin IS NOT NULL)
 begin
  -- share-lock the local login
  EXEC %%LocalLogin ( Name = @locallogin ) . Lock ( Exclusive = 0 )
  IF @@ERROR = 0
   select @localid = principal_id from sys.server_principals
    where name = @locallogin and type in ('S', 'U')
  else
  begin
   -- ADD ROW FOR NT USER LOGIN IF NEEDED --
   if (get_sid('\U'+@locallogin) IS NOT NULL)
   begin
    EXEC @ret = sys.sp_MSaddlogin_implicit_ntlogin @locallogin
    if (@ret = 0)
     select @localid = principal_id from sys.server_principals
      where name = @locallogin and type = 'U'
   end
  end
 

 

 

SQL Server 2000 basic software

$
0
0
How can I get a copy of SQL 2000 to install on a Windows 2003 Server SP2 Standard Edition? 

What is the order of locks acquired when insert a row?

$
0
0

Hi everyone,

    I got an unfinished project recently, which have serval sql statements executed very frequently. And they are locking, blocked and turning into deadlock very frequently. The reason of most of the deadlocks is the orders of locking resources are different. So I changed the statements and non-clustered indics, and the deadlocks SEEM to be disappeared.

    But one thing is confusing me. All these statments now acquire locks in this order (as i understand, which may be misunderstanding): non-clustered index, then clustered index(table). But how do insert statments acquire locks? What happens when i insert a single row?

   The last version of the project met an unaccpetable frequency of deadlocks. So, I have to submit a report about the solution describing how these locks work. But till now, I can't ensure whether the deadlocks may appear or not. I need your help, guys.

Best regards,

PS:  this is the result of sp_locks when inserting a row:

spid dbid ObjId IndId Type Resource Mode Status
54 11 690817523 0 TAB                                  IX GRANT
54 11 690817523 1 KEY (b6ea1713ddd1)                   X GRANT
54 11 690817523 2 KEY (29aa2ee435b1)                   X GRANT
54 11 690817523 2 PAG 1:174041                         IX GRANT
54 11 690817523 2 PAG 1:5041                           IX GRANT
54 11 690817523 1 PAG 1:148439                         IX GRANT

IndId 2 is the non-Clustered index and 1 is the clustered index (as i understand, because this table have only a non-clustered index and a clustered index).


Alexander


My Local Database

$
0
0

Hello,

I have started working for a company, I have SQL Server on a share drive. They created a local database in SQL Server. I can't find my local database. Where I need to look for it?

I don't want to ask our IT

Thanks,

GGGGGNNNNN


GGGGGNNNNN

Monitoring & Optimization setup on SQL server 2000.

$
0
0

Hi Team,

We have some of the SQL server 2000 which is recently handed over, though it is out of support from vendor the team will do slowly migration to latest how ever till that we need to monitor & get the email message interms of

1.Just blocking information along with what spids blocked and lead blocker (I knew there is an KB for that but it does lot and lot,but just here I need the information of only blocking information along with how long in minutes).

2.Log file usuage if it grows >90% send an mail  with the information(we have exchange server & other details ready).

3.Long running session & long running jobs -which running more than 4 hours.

4.Critical alerts of databases from the errorlog, checkdb errors,823/824, suspect of databases status.

5.SQL server services & databases status if they are unhealty or off.

so therse are all needed to be perform over the script then call from the jobs to schedule.

similarly, checkdb, reindex and update statistics(still need after rebuild though it update the statisitcs but needed for us for some reasons that we caught).

so need your help to get the script along with instructions, I knew it is straight forward to ask you guys but Iam not an code expert , we have it for >sql 2005/2008/R2/2012 only for sql 2000 =none.

we dont want to go for 3rd party tool.

Any help appreciated!


Thanks, Rama Udaya.K (http://rama38udaya.wordpress.com) ---------------------------------------- Please remember to mark the replies as answers if they help and UN-mark them if they provide no help,Vote if they gives you information.

Database is unavailable

$
0
0
  • I have a database which worked fine yesterday. But today when i tried to open the DB it is not available as shown in the following image. Please give me a suggestion to get it back. Thanks in advance.


In my sql server stolen page are very high ?

$
0
0

Hello Everyone,

Stone are very high i.e. more than 60 thousand. how to reduce them?

Server RAM 32 GB

sql server edition: sql server r2 enterprise edition

OS: Windows server 2008 r2 

Please suggest me for how to reduce stolen pages?

Thanks in advance



vb.net update code

$
0
0

i have written an update code in vb.net, that should update user records in sql server, the problem is when i click on update button in vb.net the records is updated, when i check the sql server table i discovered that the update is affecting the other rows too!!!

below is my code in vb.net 

Try Select Case MsgBox("User Details are Going to be Updated,are You Sure of this Action?", MsgBoxStyle.YesNo, "Update") Case MsgBoxResult.Yes cn.Open() query = New SqlCommand("Update ManageUsers set Fname = '" & FnameTextBox.Text & "',

Lname = '" & LnameTextBox.Text & "',

DOB = '" & DOBDateTimePicker.Value.Date & "', Passport = '" & PassportTextBox.Text & "',

Adress = '" & AddressRichTextBox.Text & "', UserName = '" & UserNameTextBox.Text & "',

Passcode = '" & PasswordTextBox.Text & "', Shift = '" & ShiftTypeComboBox.Text & "',

Gender = '" & GenComboBox.Text & "', Position = '" & PosiComboBox.Text & "' ") query.Connection = cn query.ExecuteNonQuery() MsgBox("User Details have been Updated") Case MsgBoxResult.No End Select Catch ex As Exception MsgBox(ex.Message) End Try cn.Close()





Tracking of SQL objects in 2008 R2

$
0
0

Hi,

Is there any way to track SQL objects from when its created and modified and all. I want to track all of objects in my SQL server 2008 R2. which means in some cases i need to check SP's when its last modified and by who like that. Can i take entire schema changes history for particular SP,table...etc. Can anyone help me on this?

Thanks in advance


Regards, Muthukumar Balu

question on SQL Backups.

$
0
0
Hi Experts,

Just have a question on SQL Backups.

Is there a possibility where the backup file is bigger than the actual size of the database itself? If so, what could be the reasons?

Thank you and appreciate your help.

Regards,
Sam

installation of microsoft sql server desktop engine hangs

$
0
0

During installation of MSDE the installation hangs at "please wait while Windows configures microsoft sql server desktop engine" I always end up killing the installation process. I am trying to install Windows XPe dev kit and this is the step I am getting stuck on. If I try to skip this step and setup the database the setup obviously tells me that i dont have sql 200 or MSDE installed.

 

The KB article http://support.microsoft.com/kb/811479 describes the syptoms perfectly, but fast user switching isnt even enabled for this machine and is not the source of the problem.

Viewing all 15930 articles
Browse latest View live


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