Quantcast
Channel: SQLServerCentral » SQL Server 2008 » SQL Server 2008 - General » Latest topics
Viewing all 16406 articles
Browse latest View live

mirroring connection timeout

$
0
0
HiToday I have below error in SQL Server Logs for many times during the day:The mirroring connection to "TCP://ServerName:PortNum" has timed out for database "DBName" after 10 seconds without a response. Check the service and network connections.Database mirroring is inactive for database 'DBName'. This is an informational message only. No user action is required.Database mirroring is active with database 'DBName' as the principal copy. This is an informational message only. No user action is required.The operating mode for mirroring is ,High safety without automatic failover(synchronous).The problem is that we have insert time out exactly at the the times that mirroring connection has timed out.Can mirroring has impact on principal database?I mean when the mirroring is inactive for a database,it just becomes disconnected or the transaction on principal server are involved?

Searching for a value across all columns of a single table

$
0
0
Ok i have comparsion table that has brought back all columns from a table on a local hq db and a remote location DB.There are 47 columns that have been compared and i have the following EXAMPLE col1 col2 col3 col4 col5 col6-------------------1 True True True True True True2 True True True True True True3 True True True True True True4 True True True False False True5 True True True True False True6 True True True False False TrueThere are 200K rows some all true some having a single false for a given col.what is the easiest way to search the table with out a mile long where clausewhere (col1 = false or col2 = false or col3 = false....)

Sync with Backup for Transactional Replication

$
0
0
I am curious to know if anyone has experience using the "sync with backup" option for transactional replication (https://msdn.microsoft.com/en-us/library/ms152560(v=sql.105).aspx)? We have such a small replication footprint, that I think the administrative overhead of using this feature would actually be worse than rebuilding our replication topology in the event of a disaster.Anyone else feel that way?

Backup database only if changes happen

$
0
0
I have SQL2008 database with some 100s of tables. Every 2 hours transaction log backup to tape is triggered. Just to save network bandwidth, i would like to backup the Trx logs only if there are changes in any of the tables. If no change from previous TLog backup, then no need to backup. Can someone please help me with a script or guide me with a solution.

SQL Agent CmdExec fails with no message

$
0
0
I'm having a problem running a job that calls CmdExec. The step output is just this:[quote]Date 9/15/2016 4:31:52 PMLog Job History (TheJobName)Step ID 1Server TheServerJob Name TheJobNameStep Name TheStepNameDuration 00:00:00Sql Severity 0Sql Message ID 0Operator Emailed Operator Net sent Operator Paged Retries Attempted 0MessageExecuted as user: TheSqlAgentUser. The step failed.[/quote]I know that the path is correct because if I change it, then it tells me that it can't find the file. The cmdexec looks like this:\\share\path\TheProgram.exeThe program is a console application developed in .NET. The console application runs successfully if started outside SQL Agent. This program is replacing an existing program (which was also a console application) that had been running via the same job successfully. While the program displays data to the console (data which is also logged elsewhere), it does not require any input from the console. I don't care if the console is visible. It's a long-running application, so it should leave the job in a running state, not in an immediate failure state.To add complication to this scenario, the server on which this is running was recently replaced. All software was reinstalled and the database was restored. So it's possible that any special configuration that was done to allow SQL Agent to run this job was lost. The knowledge of that configuration, if any, was lost years ago when the initial developer left.The application should be logging, but it appears the error, whatever it is, occurs before the app starts. The very first thing this application does in main is to log that it's been started.If only I had an error message to work with...Ideas?

Removing orphaned subscription in replication

$
0
0
Hi,I have a subscription on server 1 and it's publication sits on server 2.Server 2 has been decommissioned and now I want to delete my orphaned subscription on server 1 but I'm not sure how to.I have tried right click and delete in ssms and also tried sp_subscription_cleanup but none of these have worked (although it says completed successfully).I'm using Transactional Replication.How can I delete this orphaned subscription?Thanks.

What is the best way to use LIKE in my situation

$
0
0
Here is a sample query. There is a clustered index on the table consisting of SourceID, PcsAssmntDataID, QuerySetID, QueryNumberID. My question is, how best to search on PcsAssmntDataID? The % is in place of a unique number. So, I need to find all of the records that end with {A^GEN.ADMPART2}. Would using RIGHT(PcsAssmntDataID,16) be better?[code="sql"]select SourceID, PcsAssmntDataID, QueryValuefrom livefdb.dbo.PcsAssmntData_Querieswhere SourceID='BRO' and PcsAssmntDataID like '%{A^GEN.ADMPART2}' and QuerySetID=11 and QueryNumberID=16[/code]

Measuring usage prior to consolidation

$
0
0
Hi all,We are planning consolidation, I have a good idea of the considerations but would be grateful to read how others gathered usage stats. I'm thinking of either using a programmatically-fired Profiler trace /EE, or one of the Redgate tools. Any 'Best Practice' hints warmly welcomed!! ;) JB

MAXDOP(1) not working in Resource Governor

$
0
0
We are running SQLServer 2008 Enterprise. I have a SQL query that includes multiple batch numbers in the WHERE clause. When I have 16 or few batches, the optimizer selects a serial processing plan and runs in 30 seconds. When I add a 17th batch, it selects a parallel plan and jumps to 32 minutes. If I add a MAXDOP(1) hint, it runs again in 30 seconds.My issue is this: I am running the query from a 3rd party vendor, which runs against an Oracle view, that in turn runs across a database link to SQLServer views. MAXDOP cannot exist in the view definition, so I have to find an alternate method of forcing it into serial processing.After some research, I found that Resource Governor is another way to control parallel processing, and I am able to set up a workgroup by user.With SSMS, I enabled resource governor, set up a resource pool, set up a workload group, and a classifier function to route to my workgroup by user, and reconfigured it so my changes would take effect.I know that the query is being routed to the correct workload group, as I can see the assignment in activity monitor. Even though my workload group is set to MAXDOP 1, it seems to still be using a parallel plan as it runs over 30 minutes rather than 30 seconds. What is the issue? Does resource governor MAXDOP work differently than the same hint in a SQL statement? Is it not reading / utilizing the workload group setting?Thanks in advance!

Log Shipping

$
0
0
After performing a fail-over to my secondary database I'm a bit unsure what step(s) I should take next as the former-primary server is no longer online, but the SQL Jobs are still attempting to run on the fail-over server. Would I want to execute the sp_delete_log_shipping_secondary_primary procedure? Goal: The secondary database is now the only instance running and will not be participating in log shipping moving forwarded.

how can I use a sproc @param as column alias?

$
0
0
How can use a sproc param as a column alias? For example:SELECT '12345' AS @MySprocParamI tried the following sql but it doesn't work:DECLARE @MySprocParam VARCHAR(50) = 'TestAlias'SELECT 'ASDF' AS @MyProcParam

How to grant view definition access only on Views & Functions in SQL Server 2K8R2

$
0
0
Hi,I have a situation to grant view definition access only on functions and views in XXX database to a login.Do we have a any direct TSQL command or i need to write some code to achieve this? Any suggestions pleaseThanksSeshu

Sql Job Failing

$
0
0
Hello All,I am new to database. I created a sql job which takes backup of database once in a week. But its been failing. I receive below mentioned error. Code: 0xC002F210 Source: Check Database Integrity Task Execute SQL Task Description: Executing the query "DBCC CHECKDB(N'DB') WITH NO_INFOMSGS " failed with the following error: "The transaction log for database 'DB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases A database snapshot cannot be created because it failed to start. The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline. The database could not be exclusively locked to perform the operation. Check statement aborted. The database could not be checked as a database snapshot could not be created and the database or table could not be locked. See Books Online for details of when this behavior is expected and what workarounds exist. Also see previous errors for more details. Could not write a checkpoint record in database ID 5 because the log is out of space. Contact the database administrator to truncate the log or allocate more space to the database log files.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 11:00:01 AM Finished: 11:01:01 AM Elapsed: 60.157 seconds. The package execution failed. The step failed.

Alert team when tempdb reaches threshold

$
0
0
Can any one tell if there is a procedure to monitor tempdb periodically like in a job and alert the team when it fills up 85% of the tempdb fixed amount files.

Attaching 2K12 db to 2K8 R2 not working

$
0
0
Hi All,I've detached a db from 2K12 and attempted to attach it to a 2K8 R2 server, I get an error that I assumed I needed to change service credentials in server and agent services to my domain credentials. I did this. The 2K12 SQL no longer recognized the 2K8 server. At this I'm considering upgrading the 2K8 to 2K12 as a remedy but as a last resort. There is another post that recommended the aforementioned steps...they didn't help me. Importing the data is virtually starting over. Anyone out there with suggestions...any help is welcome!Thanks!

Changing mdf files size

$
0
0
Hi Experts,We have a database. It will grow max around 5 GB but we allocated 10 GB.Due to large size backup size is also growing large. If we reduce the allocated file size, will there be any issue?

query to repeat insert same rows

$
0
0
i want to make a query using cte to insert multiple rows with same field.i have a result query with information how many rows should be inserted like this.[code]KeyHD CountInserted1 22 53 7[/code]it means, KeyHD number 1 insert 2 rows with same field, KeyHD number 2 insert 5 rows, etc..i can make the query using cursor and looping it.. but i think it can be solved using cte recursive. i'm not familiar with it..Please help...Thank you..

Running Count based on time range

$
0
0
I've been beating my head against this one for a while, so any tips are very much appreciated. It really seems like it shouldn't be this hard.I have data like what is shown in the "Data:" box in the picture below, and I would like to create a query that will return something like the "Goal:" box in the picture. I want a count of the distinct ID for records who's TimeStart is before the Time but who's TimeEnd is after.I have the Time field in another table, all I can think to do is a full outer join to the other table and maybe like a case when.[img]http://www.sqlservercentral.com/Forums/Attachment19485.aspx[/img]

Execute stored procedure A and systems is running stored procedure B????

$
0
0
Running MSSQL 2008/R2 on a Windowes 2000 R@ server.I ran the following from MSSQL the management studio:use productionexec [b]proc_InsertDocumentLink[/b] 700074, 208, 1025, 1021, 95707goand the message that returned was the following:Msg 8144, Level 16, State 2, Procedure procRecurringApptsCreate, Line 0Procedure or function [b]procRecurringApptsCreate[/b] has too many arguments specified.The statement has been terminated.Have restarted MSSQL and also the entire server and I keep getting same message.Cannot find anything doing a Google search that comes close to addressing this. Please help, as this is a production server.What could be causing MSSQL to try and execute a different stored procedure rather than the one querried?Thank youRich

maxrecursion Other Option

$
0
0
What are other option instead of using maxrecursion in sql server 2008 ?
Viewing all 16406 articles
Browse latest View live