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

Single User Mode in SQL LocalDb 2012

$
0
0

Hi,

Is it possible to run SQL LocalDB in single user environment to restore master database? I have access only to sqlCmd tool.

I tried following from DOS window.

"C:\Program Files\Microsoft SQL Server\110\LocalDB\Binn\sqlservr.exe" -m

sqlcmd -S (localdb)\v11.0

If I run RESTORE master database in the sqlcmd window, I get a message stating I am not running in single user mode. Is my syntax/steps incorrect or SQL LocalDB does not run in single user mode?

Thanks

Pare.





Data warehouse File groups and Table partition designing

$
0
0

Hi Experts,

Project: Datawarehouse migration from Oracle to SQL Server 2012


In Oracle

Number of Schemas in Oracle - 6
Tables: Each Schema has 3 partitioned tables and three unpartitioned tables
Every schema has its own Table space, all non partitioned tables are in its own Table Space
Every partitioned table(three tables in each schema) is partitioned on date partition column. i.each year a new partition is added to that table
(PART_2011, PART_2012, PART_2013 ...etc)

In SQL Server
All schemas from oracle are migrated to SQL Server in to one database with seperate schema name
Number of Schemas:6
Tables: Each Schema has 3 partitioned tables and three unpartitioned tables

My Question: Can you please suggest me how to plan the file groups and partitions in SQL Server like FILEGROUPS for each schema or FILEGROUPS for every year

Let me know if you need more info

MSSQL 2000 SQL Agent Jobs view and modify

$
0
0

Hi ~ I would like to create a login which can only view and modify the SQL agent Job.

I grant the login as db_owner already for msdb already. But there is still error on it.

How to get execute user information from "sys.dm_exec_sql_text"

$
0
0

Hello,

Some day ago, my database lose data. Somebody delete rows in table by "Microsoft SQL Manager tools" so i can't trace what they do.

I using SQL, get history of statement executed. But how to know : Who execute, Workstation name ?

SELECT  * into #temp
FROM    sys.dm_exec_query_stats d
        CROSS APPLY sys.dm_exec_sql_text(d.plan_handle) AS e where text like '%delete%' order by creation_time asc

Thanks for your help.


Cuong

Is there any Microsoft product for In-Memory Database?

$
0
0

 Hello All

Is there any Microsoft product for In-Memory Database System like Oracle's TimesTen database?

I have searched and found something called xVelocity,,Whether it is equivqlent to TimesTen ?

Thanks

Saqib  Ali


MindPower

Cardinality estimates on a parallel join are wrong

$
0
0

Hello everybody,

I'm having a problem with pretty simple query where the cardinality estimates seems to be off and usual methods that I knew for this kind of problem don't help.

The query:
SELECT COUNT(*) FROM
     dbo.FaktMVaR mvar
         INNER JOIN dbo.FaktSensitivitaet AS sen
                 ON mvar.DatumID = sen.DatumID
                    AND mvar.Risikofaktor1ID = sen.Risikofaktor1ID
                    AND mvar.Risikofaktor2ID = sen.Risikofaktor2ID         
         INNER JOIN dbo.DimDatum AS dd
                 ON mvar.DatumID = dd.DatumID
                    AND dd.LastVersion = 1
WHERE dd.DatumID >= 2012122700 and dd.DatumID < 2012122800 

As obviously seen in the execution plan, the join result contains actually 217Mio rows. The query optimizer expects for join of FaktSensitivitaet with FaktMVaR only 30Mio rows. Other estimates are fine.
I've already tried the following:
1. Created multi-column statistics WITH FULLSCAN for FaktSensitivitaet and FaktMVaR on 3 join columns (DatumID, Risikofaktor1ID, Risikofaktor2ID).
2. Instead of (1) created filtered indices with exactly the WHERE conditions on FaktSensitivitaet and FaktMVaR incliding (DatumID, Risikofaktor1ID, Risikofaktor2ID)
3. Updated statistics behind the clustered indices of both Fakt* tables WITH FULLSCAN.

I can provide DBCC SHOW_STATISTICS results for (1) and (2), and usually multicolumn statistics solved similar join issues.

FaktSensitivitaet (limited to date condition in where) has 723K rows, FaktMVaR - 548K rows. The 217Mio are produced through M2M relations between these tables (the result is expected and correct).

After all I've tried playing with MAXDOP query hints. They do provide positive results (MAXDOP 1 inserts a stream aggregate before huge join, MAXDOP 8 inserts a hash match aggregate), and the queries actually returned instantly (compared to 13 seconds before). Unfortunately this doesn't help in my real query which still runs slow and with wrong estimates.

I've looked at http://sqlblog.com/blogs/paul_white/archive/2011/12/06/sql-server-optimizer-bug-with-join-and-group-by.aspx
but I'm not sure whether this is my case.

I'm using SQL Server 2008 R2 SP1. Any help or hints whether the parallel execution is my problem and in what CU/Service Pack this issue could be solved is very appreciated.

Why restore of database.bak fails?

$
0
0

I have clean SQL Server 2012 and restored database from bak file created in another server. Restore was succesful.

Now I made new restore for the just created database from same bak file. It fails.

It says SQL error. It is being used by by the database.

I tried from Option and Replace existing database. No effect. Same error when restore the same bak file with different name.

What could be reason?


Kenny_I

Keep Alive and Keep Alive Interval properties in SQL Server 2012

$
0
0

hi all,

Can anybodya explain "Keep Alive" and "Keep Alive Interval" properties in SQL Server 2012 database?

Are these propeties are useful keep uninterrupted connection from front end application (vb.net) to database even application is idle for long time?                                      


Computed Column in the include of a Non Clustered Index not working as expected

$
0
0

Hello,

I have a table with a text field containing up to 30k characters. Since I cannot use this field in the include of my indexes I have created a persisted computed column that cuts down to total length to a varchar(8000) and added this column to the include of my index.

My questions is, why don't my queries use the non clustered index and always go for the clustered index?

My index is partitioned and has the following structure:

CREATE NON CLUSTERED INDEX [XPTO] ON [TABLE1] (ID_COL ASC) INCLUDE (BIG_VARCHAR_COL) ON PART_SCH(PARTITION_COL)

My select is something like:

SELECT ID_COL, BIG_VARCHAR_COL FROM TABLE1 WHERE ID_COL='XPTO' AND PARTITION_COL=123

and my execution plan don't use the NC Index and instead uses the Clustered Index plus 2x Compute Scalar.

Why is this happening?


Luis Simões

call powershell with parameter in SQl agent job

$
0
0

I use SQL server agent job to call a powershell script. I am using Type operating system(Cmdexec)

In the job command window, I type:

powershell.exe "D:\PowershellScripts\Write-VolToDb.ps1 'MySQLserver\v2012'  dba"

It is not working. The scipt self is OK, but I just cannot figure out what is the correct syntax to call it.

The 'MySQLserver\v2012'  is my server name\instanceName, dba is the database name. They are two parameter of the powershell.

What is correct syntax of it,

Thanks


SQLFriend

SQL 2012 SP1 - SSIS Server Maintenance Job poor performance.

$
0
0

I'm using SSIS 2012 on SQL 2012 SP1 and the performance of the SSIS Server Maintenance Job is abysmal.  It's been running for 10 days and has still not completed.  Worse still it is blocking the other packages.

The maintenance job is stuck deleting data from the internal.operations table in the internal.cleanup_server_retention_window procedure.  The table only has 166,000 rows!  This is the delete statement that is causing the problem.

DELETE TOP (@delete_batch_size)
FROM [internal].[operations] 
OUTPUT DELETED.operation_id, DELETED.operation_type INTO @deleted_ops
WHERE ( [end_time] <= @temp_date
OR ([end_time] IS NULL AND [status] = 1 AND [created_time] <= @temp_date ))

The other jobs are being blocked when attempting to insert into the internal.operations table in the internal.append_event_message procedure.  This is affecting the performance of the packages.

 INSERT INTO [internal].[event_messages]
           ([operation_id],
           [event_message_id],
           [package_name],
	   [package_location_type],
	   [package_path_full],
           [event_name],
           [message_source_name],
           [message_source_id],
           [subcomponent_name],
           [package_path],
           [execution_path],
           [threadID],
           [message_code])
     VALUES
           (
           @operation_id,
           @operation_message_id,
           @package_name,
           @package_location_type,
           @package_path_full,
           @event_name,
           @message_source_name,
           @message_source_id,
           @subcomponent_name,
           @package_path,
           @execution_path,
           @thread_id,
           @message_code
           )

I am using SQL agent to execute 11 different packages every minute. This process works fine on both SQL2005 & SQL2008. I searched the forums but didn't see any fixes or workarounds for this issue. Has anyone else experience a problem with the SSIS server maintenance job? Do you have any fixes/workarounds for this issue?

The query plan for the delete shows why it performs so poorly - I guess I could add indexes to support the foreign key constrains in the related tables.

Thanks,

Tim

New DBA features of 2008R2 & 2012

$
0
0

Hi all,

what are the new DBA Features in ms sql server 2008 r2 and ms sql server 20212...?


Table level; backup and restore the same into some other instance?

$
0
0

Hi All,<o:p></o:p>

As apps tem requested to take table level backups from the database and same restore into the some other instance.. since 4 tables size is 430GB..

can anyone help on this..<o:p></o:p>

Thanks in advance.<o:p></o:p>

subbu<o:p></o:p>

9966769645<o:p></o:p>



Thanks, Subbu

multiple data file in user database

$
0
0

Hi All,

I have three database on same server with three drive F,G,H

A databsae size is 400 GB.

B databsae  size is 60 GB and C is 800 MB

and B db 50 % select and 50 % insert transaction

B database has mdf and LDF in same disk (H) with Raid 5 and SAN

A and C database has mdf in G with Raid 5 and SAN and LDF in F for both DB with only Raid 5

A DB 400 GB space is finished in this db insert is more than select

now i want to think add ndf file in A DB but in what drive i  am confused ...

If I add ndf file then how its work when i transaction is occur or index  rebuild time

Is it right adding ndf file or add space existing mdf in tems of performance

Thanks

Database curruption

$
0
0

Hi, 

CHECKDB found quite some errors on a database. The error messages are like:

Msg 8909, Level 16, State 1, Line 1

Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 0 (type Unknown), page ID (1:3817323) contains an incorrect page ID in its page header. The PageId in the page header = (0:0).

Msg 8909, Level 16, State 1, Line 1

Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 0 (type Unknown), page ID (1:3817324) contains an incorrect page ID in its page header. The PageId in the page header = (0:0).

Msg 8909, Level 16, State 1, Line 1

Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 0 (type Unknown), page ID (1:3817325) contains an incorrect page ID in its page header. The PageId in the page header = (0:0).

Msg 8909, Level 16, State 1, Line 1

Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 0 (type Unknown), page ID (1:3817326) contains an incorrect page ID in its page header. The PageId in the page header = (0:0).

To make things worse, I cannot find a good backup copy of the db. Any idea about repairing this would be greatly appreciated. 



Drive image as backup

$
0
0

Hello all,

We are taking both sql backups and drive image backups for a sql server. The sql backups are not stored permenantly as the older backup files are being deleted. But the drive image backups (the image of the drive that has the user database files) are taken every night and stored permenantly. So if we have to go back a month or so we will have to use the drive image backup. My question is: is the drive image backup a reliable solution for database files? Is it possible that the drive image is restored successfully but the database files cannot be used anymore? Please provide your thoughts.

Thanks.

Full Text Search index not showing exact search result

$
0
0

Hi,

 i have created the full text index on the table candidates.

I am Storing candidates resume in c_resume text filed.

select * from candidates WHERE contains(c_resume_text,'C++') -It shwoing c++ and also other than c++ results.

select * from candidates WHERE contains(c_resume_text,'C++11') -It showing results.

select * from candidates WHERE contains(c_resume_text,'C++1') -It showing Zero results.

Can you please help me why the above first query will showing all the records of c++ and also other than c++.

second query it not showing any results but third query showing result?

why it ignoring the third query compare to second query?

Please help me


SSMS 2012 - Connecting to SQL Server 2012 Instance is Extremely Slow

$
0
0
Every time I connect to one of my SQL Server 2012 instances on a remote server, SSMS freezes when "Loading items..." and hangs for at least ten minutes or longer. Out of the people who access this server, I'm the only one who experiences this issue. When I connect to another instance of SQL Server 2012 on a completely different machine, it responds lightening fast and I have no issues. When it does finally load items, it will be responsive for a short amount of time and then freeze again. Connecting to Analysis Services does not present problems like either, just connecting to the database engine on the single server. Any ideas what I can check i.e. configuration files, settings? My only resolution at the moment is to RDP into the server and modify database settings that way.

No Alert description for monitor "DB File Space"(SQL Server 2005 DB File)

$
0
0
I have SCOM 2007 R2 in our environment and I am facing an issue that there is not description for alert "DB File Space" (SQL 2005). Can anyone please help me to fix this.

SQL Server CONTAINS and parentheses usage with wildcards

$
0
0

We have a SQL query that returns different results depending on whether the query terms are in parentheses or not and we cannot figure out why this is the case - see below 

SELECT*FROM dbo.TABLE_X WHERE(CONTAINS(DOCUMENT_NAME,'"(rev* rec*)"'))

- returns 4 rows

SELECT*FROM dbo.TABLE_X WHERE(CONTAINS(DOCUMENT_NAME,'"rev* rec*"'))

- returns 14 rows

 

So why do the parens in the first CONTAINS negate the wildcards?  Is this a SQL bug or am I missing something here.  If missing something, please help us understand what is going on here.

Thanks,

Viewing all 15930 articles
Browse latest View live


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