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

SQL Server - Table archive

$
0
0

Hi,

I need to backup a database and restore it on another server.

I have 2 very large tables with 10 years of data and I pretend to, before the backup,  move those 2 tables data to some kind of archive and then do the backup/restore on the resulting smaller DB.

I'm planning to do the following

1 - copy those 2 tables data (every thing with more than 2 years) to a new database just for archive

2 - remove the copied data from its source tables

3 - backup source db

4 - move backup files to destination server and restore to new db

I'm thinking wright?

Is there any better way to do this kind of "archive"?

Any guide/advise?

Thanks you so much,

JD


View SSRS reports on web

$
0
0

I have developed SSRS reports.. client want them to view over the web.. they want to have a link where they can access these reports anywhere..

Can you please suggest the right option to perform this..

Thanks


Slow log backups with high CPU

$
0
0

Hi there,

We are having considerable pain when performing log backups on a large database with many files and partitions.  The database in question is over 1TB and has approximately 4,000 files (for table partitioning).

The command we use is:

BACKUP LOG [MyDb] TO  DISK = N'E:\MyDb.trn' WITH NOFORMAT, NOINIT,  NAME = N'MyDb', SKIP, NOUNLOAD, NO_COMPRESSION,  STATS = 10

The command takes 73 seconds to run (even when there have been very, very few transactions actually recorded), but the output tells a different story:

100 percent processed.
Processed 63 pages for database 'MyDb', file 'MyDb_Log' on file 1.
BACKUP LOG successfully processed 63 pages in 1.610 seconds (0.301 MB/sec).

SQL Server increases about 30% CPU usage during this 73 seconds.

The log file size itself is only about 50mb (since we regularly backup).

What is the log backup process doing to use so much CPU and take so long?

SQL Server DMV

$
0
0

Greetings All,

I want to retrieve back the past queries in my database while using DMV. My query join with dm_exec_query_stats and found out this dm_exec_query_stats only store today data, how to retrieve previous day data? DMV data will get deleted when perform restart SQL services or is there any other way to clear DMV data? Please advise. Currently I want to get back last week query and I want to know how long does my session being run. Thank you.

Regards,

Justin Wong

Database Compression - Not compressing my Databases on SQL Server 2014.

$
0
0

Can anyone answer why my SQL Server Database Backups don't appear to be applying the Data Compression option when I submit a backup using the Management Studio GUI (?).  I begin by  setting up all my information in the backup General and Media Options. then in the Backup Options I select the "Set Backup Compression"  to  (Compress Backup).   I then execute this  process...  The Backup completes successfully, however it does not compress the (.BAK) file. 

let me also mention that the sys.configuration  value is set to (1) which is enabled:

Results from Select * sys.configuration table: 

configuration_id name value minimum maximum value_in_use description is_dynamic is_advanced
1579 backup compression default 1 0 1 1 Enable compression of backups by default 1 0

The net result is my backup (.BAK) file isn't any smaller by space than my Data File... 

So it appears SQL Server isn't Compressing my Backup... 

Please Help! 

           >Moskogie< 

  

   

Differenct language setting for a same User in SQL SERVER

$
0
0

Hi All,

I have two web application and storing the information in two different databases in Sql server. I have mapped IUSER for those two databases.

Now, I want to configure the language setting for IUSR as below, So that, I can handle two different datetime settings for those two application by using the same user name.

Language 1 -> Database 1

Language 2 -> Database 2

Anyone suggestion on this? Thanks.

Best regards

Muthu

SQL server Post Validation

$
0
0

Hi All,

I need such query or queries which can show me my SQL server Status as follow

1) All SQL server services are online and running
2) All Databases are online and accessible (sp_helpdb doesn't gives correct result here )
3) SQL agent is up and running
4) All alwaysOn Availability groups are online and running 

In short I need to check status of SQL server after we reboot The Windows server. 

Failed to initialize sqlcmd library with error number -2147024809

$
0
0

I have searched around but cannot find an answer to this so any help is appreciated.  I have a 2014 server with dual instances.  When I execute the following query , it succeeds on one instance but fails on the other with the above error.  This is not related to SQL Agent, this fails on query execution within SSMS as well (on instance 2, succeeds on instance 1).  Names have been changed to generic below.  I have tried with/without various options in the call, nothing seems to work on instance 2, but works fine on instance 1.  IF I remove the @query parameter, I DO receive the email.

EXEC msdb.dbo.sp_send_dbmail

   @profile_name ='Profile1',

    @recipients = 'recipientlist',   

    @subject ='Error in rules-PLEASE INVESTIGATE-',

    @body ='There is an error in rules, a rule calls itself. Please fix.  The broken rule id is:',

    @query='select fields from table WHERE [RuleOnSuccess] = [RuleID] OR [RuleOnFailure] = [RuleID] ',

       @attach_query_result_as_file = 0;



change some fields to be anonymous

$
0
0

Hello

Could you please tell me how to change some column and their fields to be anonymous?

(I have a database and i wana give one of its tables to some one else but i dont want them to see some of the columns)

What shoud i do?

DBCC & DMV commands

$
0
0
What are the DBCC & DMV commands used in Backup & Restore of data base and server

Enable SQL Server Priority Boost to a default 0 or Disable it ?

$
0
0

Based on your experience, is it still dangerous if SQL Server Priority Boost is enabled and set to 0 ( default ) ?

Microsoft is not detailed on the impact of the default setting 0 and setting of 1. I hope to hear some details from your experiences.

Understanding moving primary key clustered index to a new file group.

$
0
0

Hello,

we are planning to move primary key clustered index to a new file group to save some space on primary file group. We are planning to use following command to move it to the new file group,

CREATE UNIQUE CLUSTERED INDEX PK_sales_sales_id ON sales(sales_id)WITH (DROP_EXISTING =  ON )ON [Sales_Index_File_Group]

Questions:
1) As per my understanding the cluster index holds actual data, will the actual data will move to new file group ? how it internally works ? Appreciate if you can provide any other useful internals on this.

Thanks.

SSMS stop displaying any database object and DBCC return database consistency error.

$
0
0

I am using Dynamics AX 2012 with SQL Server 2012. Suddenly my database stop working, when I try to check through SSMS there is no table or view or procedure displaying in the management studio but I can see all objects using information_schema.tables.

On executing DBCC command following are the results.

Msg 8944, Level 16, State 13, Line 1

Table error: Object ID 54, index ID 1, partition ID 281474980249600, alloc unit ID 281474980249600 (type In-row data), page (1:27214), row 9. Test (ColumnOffsets <= (nextRec - pRec)) failed. Values are 1036 and 97.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 54, index ID 1, partition ID 281474980249600, alloc unit ID 281474980249600 (type In-row data). Page (1:11788) is missing a reference from previous page (1:27214). Possible chain linkage problem.
Msg 8944, Level 16, State 13, Line 1
Table error: Object ID 54, index ID 1, partition ID 281474980249600, alloc unit ID 281474980249600 (type In-row data), page (1:27214), row 9. Test (ColumnOffsets <= (nextRec - pRec)) failed. Values are 1036 and 97.
Msg 8928, Level 16, State 1, Line 1
Object ID 54, index ID 1, partition ID 281474980249600, alloc unit ID 281474980249600 (type In-row data): Page (1:27214) could not be processed.  See other errors for details.
Msg 8976, Level 16, State 1, Line 1
Table error: Object ID 54, index ID 1, partition ID 281474980249600, alloc unit ID 281474980249600 (type In-row data). Page (1:27214) was not seen in the scan although its parent (1:148999) and previous (1:11208) refer to it. Check any previous errors.
DBCC results for 'sys.sysidxstats'.

5 inconsistency error.

I restored database but same error still exists


Shamas Saeed (if Post helpful please mark as Answer) http://shamas-saeed.blogspot.com

What technical difference between development and standard/enterprise editions?

$
0
0

All information which I found is devoted to legacy for different versions.

But I need to understand technical different.

Really I asked testing throughput for MSSQL Server on different configurations.

But I have only development editions.

Is it correct to check throughput on MSSQL Server Development edition or I need standard (enterprise)?

Thanks for Help & Regards,

MichaelG.

SQL query question

$
0
0

Hello,

We are having performance issues on the SQL server 2012 Ent edition. I was able to trace the expensive queries that are causing the perf issues. But I am trying to identify the host name from which those queries are being executed. Can someone refer me a article which can give host names with the expensive queries consuming high cpu, logical reads etc.

Thanks.


sqldev


Database exception: SMux Provider: Physical connection is not usable [xFFFFFFFF]

$
0
0

Hello,

In my application some time i will get below error message:

Database exception: SMux Provider: Physical connection is not usable [xFFFFFFFF]. Unable to open a logical session State:08S02,Native:-1,Origin:[Microsoft][SQL Server Native Client 11.0] State:08S02,Native:-1,Origin:[Microsoft][SQL Server Native Client 11.0]

It seems to be DB connection is getting lost in between. But I didn't find root cause why DB connection is failing.

SQL Server is installed on Virtual machine.

Any idea why application is getting lost DB connection?

Regards,

Narasimhulu


Update Statistics,Performance Issue

$
0
0

Hi,

We have Auto Update Statistics property of DBs set to true.I want to know If we have to do update statistics periodically or not!

SqlDataReader returns 0 rows when using a SQL login when called from a windows service running under a domain account

$
0
0
Hi,

We have a database problem that I will describe below:

a) We have two database servers and one application server.
b) We have a windows service running on the application server (running under a domain account) which runs a SQL command on both databases. The command uses a SQL data reader. The same stored procedure is called on both database connections using a connection string using a SQL username and password defined in the configuration file. One call returns rows and other one returns no rows.
c) Running the stored procedure on both database servers using SQL management studio returns rows using the same SQL username and password.
d) We created a stand alone application to run on the application server which just made the database call to the database server that returned no rows using the same SQL username and password. Rows where returned. Please note that the standalone application was run using the account logged in which was the domain account.
e) The calls to both databases return rows when running the windows service under the Local System account.

So it looks like running the windows service under the domain account somehow affects the database call even though the SQL connection uses a SQL username and password.

Any ideas?

Thanks
Ian

Host name is null in sql server

$
0
0

Hi,

I need help for investigating the cause behind hostname value becoming null in sql server.

I found multiple time hostname value becomes null.

using select @@servername.

which is resolved by running sp_addserver '<servername>', 'local' and restarting sql services.

But I want to know the cause of its occurrence.

SQL server database in recovery

$
0
0

Hi,

After SQL server restart SQL database went in recovery mode. i am not able to access and i try to recover the database its showing below error.

Msg 3101, Level 16, State 1, Line 1
Exclusive access could not be obtained because the database is in use.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Viewing all 5123 articles
Browse latest View live


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