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

sql server table partion each month

$
0
0

Hi Team,

I have a table which has to keep data of 3 months.  Month by month partitoning is needed here.

A scheduled job has to run everymonth(likely first sunday of each month) to add a new partition and delete data which is more than 3months/90 days.

Can you please provide me any script or any related post which can give me some idea?

Thanks,

Areef


Unexpected shutdown for SQL server creating mini dump file

$
0
0

We are using 3 SQL instances (2005 SP4) in cluster network (active passive) and all 3 instance would be running on same node. We have 18GB total memory and max memory for instance1 = 8, other 2 = 4 GB each. So we still have 2 GB for OS.

We got sudden stopping on instance 1 and created a mini dump. I am pasting the SQL logs below. Please anyone help me on this.

here are some errors I see in logs:

2014-02-06 12:34:18.300 Server       Error: 4014, Severity: 20, State: 2.
2014-02-06 12:34:18.300 Server       A fatal error occurred while reading the input stream from the network. The session will be terminated.
2014-02-06 12:47:04.430 Server       Error: 4014, Severity: 20, State: 2.
2014-02-06 12:47:04.430 Server       A fatal error occurred while reading the input stream from the network. The session will be terminated.
2014-02-06 13:02:42.260 Server       Error: 4014, Severity: 20, State: 2.
2014-02-06 13:02:42.260 Server       A fatal error occurred while reading the input stream from the network. The session will be terminated.
2014-02-06 13:15:24.530 Server       Error: 4014, Severity: 20, State: 2.

....

2014-02-06 15:44:10.280 spid1s       AppDomain 2 (OperationsManager2007.dbo[runtime].1) is marked for unload due to memory pressure.
2014-02-06 15:44:10.290 spid1s       AppDomain 2 (OperationsManager2007.dbo[runtime].1) unloaded.
2014-02-06 15:44:27.400 spid86        Failed Virtual Allocate Bytes: FAIL_VIRTUAL_RESERVE 589824
2014-02-06 15:44:27.440 spid86      
Memory Manager
 VM Reserved = 1765904 KB
 VM Committed = 137548 KB
 AWE Allocated = 8388608 KB
 Reserved Memory = 1024 KB
 Reserved Memory In Use = 0 KB 2014-02-06 15:44:27.440 spid86      

...

2014-02-06 15:44:27.450 spid86       Procedure Cache:  TotalProcs=36 TotalPages=1655 InUsePages=7442014-02-06 15:44:27.450 spid86       Process physical/virtual memory pressure: 0/0 System physical memory pressure: 02014-02-06 15:44:27.450 spid86       Global Memory Objects:
  Resource= 789
  Locks= 559
  SE Schema Mgr= 1180
  SQLCache= 237
  Replication= 2
  ServerGlobal= 28
  XPGlobal= 2
  Xact= 296
  SETLS= 8
  DatasetMemObjs= 16
  SubpDescPmos= 41
  SortTables= 22014-02-06 15:44:27.450 spid86       Query Memory Objects:  Grants=13 Waiting=0 Maximum=130473 Available=94406 Limit=1304732014-02-06 15:44:27.450 spid86       Query Memory Objects:  Next Request=0 Waiting For=0 Cost=0 Timeout=0 Wait Time=0 Last Target=1373402014-02-06 15:44:27.450 spid86       Small Query Memory Objects:  Grants=0 Waiting=0 Maximum=6867 Available=6867 Limit=68672014-02-06 15:44:27.450 spid86      
Optimization Queue
 Overall Memory = 1200144384 Target Memory = 1080016896 Last Notification = GROW Timeout = 6 Early Termination Factor = 5
2014-02-06 15:44:27.450 spid86      
Small Gateway
 Configured Units = 32 Available Units = 30 Acquires = 2
 Waiters = 0 Threshold Factor = 250000 Threshold = 250000
2014-02-06 15:44:27.450 spid86      
Medium Gateway
 Configured Units = 8 Available Units = 8 Acquires = 0
 Waiters = 0 Threshold Factor = 12 Threshold = 45000704
2014-02-06 15:44:27.450 spid86      
Big Gateway
 Configured Units = 1 Available Units = 1 Acquires = 0
 Waiters = 0 Threshold Factor = 8 Threshold = -1
2014-02-06 15:44:27.450 spid86      
MEMORYBROKER_FOR_CACHE
 Allocations = 5739
 Rate = -338
 Target Allocations = 128906
 Future Allocations = 0
 Last Notification = GROW 2014-02-06 15:44:27.450 spid86      
MEMORYBROKER_FOR_STEAL
 Allocations = 8261
 Rate = 410
 Target Allocations = 131838
 Future Allocations = 0
 Last Notification = GROW 2014-02-06 15:44:27.450 spid86      
MEMORYBROKER_FOR_RESERVE
 Allocations = 36067
 Rate = 0
 Target Allocations = 146502
 Future Allocations = 32618
 Last Notification = GROW 2014-02-06 15:44:27.460 spid86       Error: 701, Severity: 17, State: 123.
2014-02-06 15:44:27.460 spid86       There is insufficient system memory to run this query.
2014-02-06 15:44:31.030 spid86       Error: 701, Severity: 17, State: 123.

...

2014-02-06 23:54:09.960 Server       CImageHelper::Init () Failed load of dbghelp.dll - Not enough storage is available to process this command.
2014-02-06 23:54:11.210 Server       **Dump thread - spid = 0, PSS = 0x00000000, EC = 0x00000000
2014-02-06 23:54:11.770 Server       CImageHelper::Init () Version-specific dbghelp.dll is not used
2014-02-06 23:54:11.770 Server       CImageHelper::Init () Failed load of dbghelp.dll - Not enough storage is available to process this command.
2014-02-06 23:54:14.480 Server       ***Symbol load failed - Proceed to dump without any symbols
2014-02-06 23:54:15.460 Server       ***Stack Dump being sent to G:\MSSQL.1\MSSQL\LOG\SQLDump0053.txt
2014-02-06 23:54:15.460 Server       * *******************************************************************************
2014-02-06 23:54:15.460 Server       *
2014-02-06 23:54:15.460 Server       * BEGIN STACK DUMP:
2014-02-06 23:54:15.460 Server       *   02/06/14 23:54:15 spid 0
2014-02-06 23:54:15.460 Server       *
2014-02-06 23:54:15.460 Server       * Non-yielding Resource Monitor
2014-02-06 23:54:15.460 Server       *
2014-02-06 23:54:15.460 Server       * *******************************************************************************
2014-02-06 23:54:15.460 Server       * -------------------------------------------------------------------------------
2014-02-06 23:54:15.460 Server       * Short Stack Dump
2014-02-06 23:54:21.210 Server       Stack Signature for the dump is 0x00000242

Any suggestion please on this ??

Spread the Love! Be our SS DBE TechNet Guru, this Valentine's

$
0
0

TechNet loves you!

 

We love your contributions at TechNet Wiki sooo much that we give you more than just love in return...

We give you NOTORIETY, GLORY... and VIRTUAL MEDALS!

That's not all, this love we have, together, it flows both ways my friend.

You give us stuff, we give you stuff, like interviews, recognition points, Ninja Belt rankings, and of coursefront page love!

If the love is strong enough, who knows where it could end! We may even invite you into secret clubs and other initiatives.

So why not spread the love a little further this Valentines, with more than just a cheap card from the highstreet...

Express your love for your favourite technology in a TechNetWiki article!

Pour your heart out to us, capture our hearts and woo us with your prowess!

 

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.


SQL AGENT JOB FOR DISK SPACE USAGE ALERT

$
0
0

Hello Experts

what is the best way to set up a disk space usage alert for my sql server 2008r2 databases. i want to get a notification or alert whenever the disk usage is >80%, thank you as usual.

Beli

Timeout issue - Linked server

$
0
0

Hi,
We have linked server in sql server from AS400. From last couple of days it shows connection between sql server and As400 through this linked server is slow. Sometimes application timeout. How to resolve this issue? How to find out if issue is at sql server side or as400? or how to improve query response time through this linked server.
thanks

Full backup is not happening due to consistent checkpoint

$
0
0

Full backup is not happening due to consistent checkpoint.

We have sql server 2008 r2 wherein a database is of 1.2 TB size. This database files have been properly splited across multiple drives. Log backup is happening fine, but whenever we start full backup, it is blocked by checkpoint process. Some time luckily if it gets completed then fine or issues continues. recently applied Sql Server 2008 r2 sp1 cu3 to fix this issues, but still full backup is not happening. Anything we are missing on here.

Thanks


Santosh Singh

activity monitor/performance dashboard historical reports

$
0
0

We  have performance dashboard reports (SQL 2008 R2 ) to get current state of the system i.e.  including cpu, resource waits etc. but is it possible to alter it to get it working for past periods. i.e. if we have kept archived copies of DMVs, would it require changing any of the SPs?

I saw in a few forum questions that a few custom reports can be built using RDL. Appreciate if you can redirect me to a few resources needed for the above requirement as I haven't got much experiencing working with RDL.

Thanks.

Log shipping question

$
0
0

Hi All,

I always ask this question to myself very often and sometimes get confused.

Why is log shipping called a Disaster recovery solution and not a High availability solution even though it provides High availability of the database as a warm standby. Other technologies like Database mirroring and Clusterring are called High availability technologies.

Why is log shipping called a Disaster recovery solution?

Pl correct me if my statement is wrong because I heard about these terms on log shipping by lot of people.

Thanks in advance.


Restoring Database to different instance with encryption problems

$
0
0

Hello All!

       I am having an issue of reading an encrypted table after restoring the table to a different server and instance.

Here is my process thus far:

Performed Full backup of database

Restored database backup on new instance (The new instance is using the same Service account as the old instance)

After restoring the database, I checked to make sure the database master key shows encrypted by server, but it does not

Running the following query on each database:

select d.name,d.is_master_key_encrypted_by_server

 fromsys.databasesASd

On the old instance, the database is_master_key_encrypted_by_server = 1
On the new instance, the database is_master_key_encrypted_by_server = 0

Does anyone know why this is?

If I run the select * fromsys.symmetric_keyson each database, the database master key and the symmetric key shows up for each database instance.

Is there a reason why this is different?

I know the SMK encrypts the DMK which then is used to encrypt the certificate that encrypts symmetric key. 
Therefore, should I export the SMK from the from the old instance and import it into the new instance?  Then open the master key and regenerate the SMK on the server so that I can open the encrypted table on the new instance?

Thanks!

 

Index Reorg completes but Update statistics fails

$
0
0

SQL Server 2008 SP3 Enterprise 64 bit on a Windows Server 2008 R2 Enterprise

In the steps above, Index Rebuild completed but Update Statistics failed on 

Msg 9100, Level 23, State 2, Line 1
Possible index corruption detected. Run DBCC CHECKDB.

I understand that running a Statistics Update after an index rebuild is a waste, http://www.sqlskills.com/blogs/paul/search-engine-qa-10-rebuilding-indexes-and-updating-statistics/

However, I am trying to find out how there could be a index corruption right after a index rebuild. I ran a dbcc checkdb on the database where the corruption was encountered but the dbcc checkdb completed without any errors. 

I then ran a update statistics on the same database following a successful dbcc checkdb but it failed with the same index corruption. 

Please guide. 



Partition scheme

$
0
0

I created a partition scheme with:

CREATE PARTITION SCHEME IQPScheme_Right AS PARTITION IQPFN_FinalizeDateRight ALL TO ([PRIMARY])

 

I then created a partition function with:

CREATE PARTITION FUNCTION IQPFN_FinalizeDateRight (DATE)

AS RANGE RIGHT FOR VALUES ('06/22/2014', '07/22/2014', '08/22/2014', '09/22/2014', '10/22/2014', '11/22/2014',

                           '12/22/2014', '01/22/2015', '02/22/2015', '03/22/2015', '04/22/2015', '05/22/2015',

                           '06/22/2015', '07/22/2015', '08/22/2015', '09/22/2015', '10/22/2015', '11/22/2015')

 

Now I want to expand the dates in the partition function, which I know I can do with ALTER PARTITION FUNCTION.

 

Do I need to also alter the SCHEME?  I ask ONLY because when I script out the scheme, I get the following:

 

CREATEPARTITIONSCHEME [IQPScheme_Right]AS PARTITION[IQPFN_FinalizeDateRight] TO ([PRIMARY],[PRIMARY], [PRIMARY],[PRIMARY],[PRIMARY], [PRIMARY],[PRIMARY],[PRIMARY], [PRIMARY],[PRIMARY],[PRIMARY], [PRIMARY],[PRIMARY],[PRIMARY], [PRIMARY],[PRIMARY],[PRIMARY], [PRIMARY])

 

How come I used the “ALL TO” verb when creating the partition scheme SQL created on entry for every entry in the partition function??????

 

Does this mean I need to ALSO expand the scheme?    If so, how????

 

Thank you.

 

 

 

 

 

 

 


André


database migration question

$
0
0

SQL server A----Database AA

SQL Server B---Database BB

Do database migration:

I backup database AA on sql server A--create aa.back file

then I copy aa.bak file to Server B and restore aa.bak as BB(Overwrite database BB there).

I want to make sure that new database BB(restore from aa.bak) will have all the same as old database BB there--security, store procedure.........

How to do it?want to know the best way.Now, I have to compare each piece. That's too much work.

Issue using Tools->Options->Result to Text to customize column delimiter

$
0
0

Hi all,

I need to export a large dataset (greater than 6 GB) to text file.

Since the dataset contains special characters, I cannot use Import and Export Wizard to export it into text file. (Error Message).

So I used Tools --> Options --> Result to Text. However, I cannot actually customize the delimiter.

First of all, I can only enter one character as the delimiter, and thus no character combination allowed.

Secondly, I entered # and ^ as the customized delimiter. Neither of them worked. The delimiter is always | (pipe), which does not work well for my dataset.

Does anybody have the same experience? Please help.

Thanks.

we have cluster sql error 19019

$
0
0

we  have two node, recently we move the storage to another new one, then we get the following error in the cluster events:

online thread; could not connect to server but server is considered up.

SQL2012 SP1 - Errorlog message: Failed to allocate BUFs: FAIL_BUFFER_ALLOCATION 1

$
0
0

Hi all,

recently i have received following errors in my errorlog:  Failed to allocate BUFs: FAIL_BUFFER_ALLOCATION 1

this error is followed by:

  Memory Manager                                   KB  ---------------------------------------- ----------  VM Reserved                               199883944  VM Committed                                1126732  Locked Pages Allocated                     93081276  Large Pages Allocated                        663552  Emergency Memory                               1024  Emergency Memory In Use                          40  Target Committed                           94208008  Current Committed                          94208008  Pages Allocated                            86598816  Pages Reserved                             11613176  Pages Free                                   180192  Pages In Use                               33532456  Page Alloc Potential                       55965144  NUMA Growth Phase                                 2  Last OOM Factor                                   2  Last OS Error                                     0
  Memory node Id = 0                               KB  ---------------------------------------- ----------  VM Reserved                               199702040  VM Committed                                1021692  Locked Pages Allocated                     22530308  Pages Allocated                            16197104  Pages Free                                    30936  Target Committed                           23552000  Current Committed                          23552000  Foreign Committed                            237888  Away Committed                                    0  Taken Away Committed                              0
  Memory node Id = 1                               KB  ---------------------------------------- ----------  VM Reserved                                   35712  VM Committed                                  35732  Locked Pages Allocated                     23516264  Pages Allocated                            23469208  Pages Free                                    47056  Target Committed                           23552000  Current Committed                          23552000  Foreign Committed                            203440  Away Committed                                    0  Taken Away Committed                              0
  Memory node Id = 2                               KB  ---------------------------------------- ----------  VM Reserved                                  113296  VM Committed                                  36500  Locked Pages Allocated                     23515496  Pages Allocated                            23464184  Pages Free                                    51312  Target Committed                           23552000  Current Committed                          23552000  Foreign Committed                            170116  Away Committed                                    0  Taken Away Committed                              0
  Memory node Id = 3                               KB  ---------------------------------------- ----------  VM Reserved                                   32768  VM Committed                                  32788  Locked Pages Allocated                     23519208  Pages Allocated                            23468320  Pages Free                                    50888  Target Committed                           23552000  Current Committed                          23552000  Foreign Committed                             77112  Away Committed                                    0  Taken Away Committed                              0
  Memory node Id = 64                              KB  ---------------------------------------- ----------  VM Reserved                                       0  VM Committed                                     20  Locked Pages Allocated                            0

and much more...

Anyone has an idea what is going on?

I have started up a perfmon with a couple of counters, also include the sqlServer Buffermanager (BCHR,Page life expectancy,...)

Can someone help me analys this issue?

Thanks in advance!

Kr

Jan


Understanding of Perfmon-WorkingSet SQL Server Values

$
0
0

Hi All:

Working Set is the term that defines the amount of memory currently in use for a process

In one of the server, just i noticed the Working Set of SQL Server is --> 6,514,200,576

Please let me know how can we understand this value and let me know how can we convert it to understandable value.

Thanks,

Satish Kumar.


Thanks, Satish Kumar. Please mark as this post as answered if my anser helps you to resolves your issue :)


About tempdb

$
0
0

I add datafiles tempdb2.ndf and tempdb3.ndf when tempdb out of space.

So temp.mdf on E drive, tempdb2.ndf on F drive and tempdb3.ndf on G drive

May I delete tempdb2.ndf and tempdb3.ndf?How can I remove tempdb2.ndf and tempdb3.ndf?

Thanks

Database in "Restoring" state --- HELP

$
0
0
Ok.  I have spent hours on this already.

We were restoring a database from tape.  The tape drive failed in the middle of the restore.  So now we CANNOT restore from tape to try again.

Before I started the restore, I detached and made a copy of the database files.

The database is in "Restoring" state.  All I want to do is DELETE the "restoring" database and attach the copy.

How do I get rid of this thing?????  In 2000 it was an update of the sys.databases.  In 2005, you cannot do that anymore.


SQL 2005 (9.0.2153)

Unable to cycle error log due to lock that will not clear

$
0
0
Hello,

Currently I'm having an issue with cycling the error log on two SQL Server Instances because the file is being used by another process. Simple I know but, when you try to kill the SPID it becomes hung and we are forced to restart the instance, which I want to avoid at all costs. To give you some background we use sqldm for our monitoring of the databases and received a message that our Error log reached its max size threshold and to cycle the error log. When I executed exec sp_cycle_errorlog I'm told the following message:

Msg 17049, Level 16, State 1, Procedure sp_cycle_errorlog, Line 9
Unable to cycle error log file from 'J:\MSSQL10.SQL6\MSSQL\Log\ERRORLOG.1' to 'J:\MSSQL10.SQL6\MSSQL\Log\ERRORLOG.2' due to OS error '32(The process cannot access the file because it is being used by another process.)'. A process outside of SQL Server may be preventing SQL Server from reading the files. As a result, errorlog entries may be lost and it may not be possible to view some SQL Server errorlogs. Make sure no other processes have locked the file with write-only access."
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Then I ran the following query in instance A and found that sqldm had a active process.

SELECT *
FROM sys.dm_exec_requests a
OUTER APPLY sys.dm_exec_sql_text(a.sql_handle) b
WHERE session_id > 50
and session_id <> @@spid AND( text = 'xp_readerrorlog'  OR  text = 'sp_cycle_errorlog')
ORDER BY start_time a

Like I said before when I kill the SPID it became hung and remains in a rollback state (the process is not rolling back). My co-worker had this issue before on this same instance and contacted Idera for support, here was their response "The development team provided an update regarding this case. After reviewing the code, SQLdm only reads the SQL logs information in each collection and does not lock this resource. Given the behavior that you described,  this could be a problem of SQL Server 2008"

I believe they're right because we're only seeing this in these two instances. All other instances using sqldm are not reporting this problem which leads me to believe it is MS SQL Server causing it. This is where I'm stuck and that is trying to find out why there is a lock on this file and for what reason. I used Process explorer yesterday to search for any processes that are using ERRORLOG through the Find DLL and Handle window and there were mulitple processes touching this file. When I looked today I'm seeing now locks for this file and I still cannot cycle the error log. I ran the slect query above I'm still seeing sqldm SPID in both instances. I'm curious to see if anyone else has had this issue before whether they used sqldm or not. Any information will be helpful in tracking this issue down.

Thank you in advance.

Process Explorer Search Results

Instance A

Instance B

Conversion from SQL 2005 to SQL 2012 Express

$
0
0
Looking to move a small database from SQL 2005 to SQL 2012 Express - can a 2005 backup file be restored to a newly created 2012 Express database file?
Viewing all 15264 articles
Browse latest View live


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