<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>answers &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/answers/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 24 Jul 2016 14:11:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-6)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 23 Jul 2016 14:09:23 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dynamic data masking]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[row level security]]></category>
		<category><![CDATA[secure view column]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3397</guid>

					<description><![CDATA[How do you grant a SQL Server developer truncate table permission without giving them the ability to alter the table? This is accomplished by a DBA creating a stored procedure with the TRUNCATE TABLE statements and then granting execute permission on the stored procedure to those who need it. I have a table where some [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-6%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-row-level-security-sql-injection-data-masking-day-6/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-6)"></a></p><p><strong>How do you grant a SQL Server developer truncate table permission without giving them the ability to alter the table?</strong></p>
<blockquote><p>This is accomplished by a DBA creating a stored procedure with the TRUNCATE TABLE statements and then granting execute permission on the stored procedure to those who need it.</p></blockquote>
<p><strong>I have a table where some of the columns should not be queryable by all users. How can I filter the data appropriately, so that not everyone can select the data?</strong></p>
<blockquote><p>One of the easiest ways to do this is through the use of views.</p>
<p>If we can use a view, we can successfully filter the data and grant the users access to the view, we can present just the data we want the users to have access to.</p>
<p>however, there are two requirements for this:</p>
<ul>
<li>The users do not already have the ability to select data from the table.</li>
<li>A view can be created where an ownership chain can be established with the table.</li>
</ul>
</blockquote>
<p><strong>How to grant only few columns without creating views?</strong></p>
<p>We can assign column list to table.</p><pre class="crayon-plain-tag">GRANT SELECT ON dbo.Employee (EmployeeID, FirstName, MiddleName, SurName) TO HR_Intern;</pre><p>
<strong>I can create Stored Procedure, but However, when I went to execute the stored procedure, SQL Server told me I didn&#8217;t have permission to do so. Is this a bug or did I do something wrong?</strong></p>
<blockquote><p>This is entirely possible if you have the ability to create a stored procedure in a schema you don&#8217;t own.</p>
<p>In this particular case we&#8217;ve created a role that has the ability to create stored procedures in the database and the ability to alter the dbo schema. By default, the dbo schema is owned by the database owner.</p></blockquote>
<p><strong>What do you know about the SQL Server 2016 Row Level Security?</strong></p>
<blockquote><p>SQL Server 2016 has introduced Row Level Security (RLS) which is a feature that enables fine grained control over access to rows in a table. RLS allows you to easily control which users can access which data with complete transparency to the application.This enables us to easily restrict the data based on the user identity or security context.</p>
<p>Row-Level Security enables customers to control access to rows in a database table based on the characteristics of the user executing a query.</p></blockquote>
<p><strong>Which are the different predicates support by Row Level Security?</strong></p>
<blockquote><p>RLS supports two types of security predicates.</p>
<p>Filter predicates silently filter the rows available to read operations (SELECT, UPDATE, and DELETE).</p>
<p>Block predicates explicitly block write operations (AFTER INSERT, AFTER UPDATE, BEFORE UPDATE, BEFORE DELETE) that violate the predicate.</p></blockquote>
<p><strong>What do you know about the Dynamic Data Masking?</strong></p>
<blockquote><p>Dynamic data masking limits sensitive data exposure by masking it to non-privileged users. Dynamic data masking helps prevent unauthorized access to sensitive data by enabling customers to designate how much of the sensitive data to reveal with minimal impact on the application layer. It’s a data protection feature that hides the sensitive data in the result set of a query over designated database fields, while the data in the database is not changed.</p>
<p>For example, a call center support person may identify callers by several digits of their social security number or credit card number, but those data items should not be fully exposed to the support person. A masking rule can be defined that masks all but the last four digits of any social security number or credit card number in the result set of any query.</p></blockquote>
<p>What should be the characteristics for strong password?</p>
<ul>
<li>Is at least 8 characters long.</li>
<li>Combines letters, numbers, and symbol characters within the password.</li>
<li>Is not found in a dictionary.</li>
<li>Is not the name of a command.</li>
<li>Is not the name of a person.</li>
<li>Is not the name of a user.</li>
<li>Is not the name of a computer.</li>
<li>Is changed regularly.</li>
<li>Is significantly different from previous passwords.</li>
</ul>
<p><strong>How SQL Injection Works?</strong></p>
<blockquote><p>The primary form of SQL injection consists of direct insertion of code into user-input variables that are concatenated with SQL commands and executed. A less direct attack injects malicious code into strings that are destined for storage in a table or as metadata. When the stored strings are subsequently concatenated into a dynamic SQL command, the malicious code is executed.</p>
<p>The injection process works by prematurely terminating a text string and appending a new command. Because the inserted command may have additional strings appended to it before it is executed, the malefactor terminates the injected string with a comment mark &#8220;&#8211;&#8220;. Subsequent text is ignored at execution time.</p></blockquote>
<p><strong>What are your best practices to avoid SQL Injection?</strong></p>
<ul>
<li>Validate all input.</li>
<li>Use Type-Safe SQL Parameters.</li>
<li>Use Parameterized Input with Stored Procedures.</li>
<li>Wrapping Parameters with QUOTENAME() and REPLACE().</li>
<li>Use the Parameters Collection with Dynamic SQL.</li>
</ul>
<p><strong>How Do You Determine What Data Are Confidential?</strong></p>
<ul>
<li>We should to contact our legal department (if there is one), an attorney, or law professor, if in doubt about data.</li>
<li>Ask about, What type of data should we be extra cautious about?</li>
<li>Ask government officials or look at government websites on the industry we are in.</li>
<li>We should think like a hacker.</li>
</ul>
<p><strong>Have you seen any performance hit using SQL Server Transparent Data Encryption (TDE)?</strong></p>
<blockquote><p>Given that you are performing more operations, there is some. One advantage to TDE is that the data is only encrypted in disk. So if it&#8217;s in SQL Server&#8217;s memory buffers, there&#8217;s no repeated decryption going on.</p></blockquote>
<p><strong>Any concerns about the SQL Server public database role?</strong></p>
<blockquote><p>Yes, the general recommendation is to avoid using the public role. Every database user is a member of public. As a result, any permissions assigned to it are also assigned to every database user.</p></blockquote>
<p><strong>What do you use to avoid the SQL Server fixed server roles?</strong></p>
<blockquote><p>The recommended practice is to create a role and assign explicit permissions.</p>
<p>A developer wants to execute a SQL Server stored procedure in debug mode. I believe SQL Server sysadmin level access required to use debug mode. I don&#8217;t want to give sysadmin access to the developer. Is there any I can handle this without giving sysadmin access?</p>
<p>Unfortunately, there is not. Debugging requires sysadmin role membership.</p></blockquote>
<p><strong>Is it possible to grant linked server permissions to Windows user group?</strong></p>
<blockquote><p>Yes: A Windows group is no different from any other login.</p></blockquote>
<p><strong>T-SQL Script to find mismatched between Database Login and Server Login.</strong></p><pre class="crayon-plain-tag">SELECT d.[name] AS 'DB User', s.[name] AS 'Login', s.sid AS 'SID'
FROM sys.database_principals d
 JOIN sys.server_principals s
 ON d.sid = s.sid
WHERE d.[name] &lt;&gt; s.[name];</pre><p>
<strong><br />
What is the main hierarchy of Permissions?</strong><br />
<a href="https://msdn.microsoft.com/en-us/library/ms191465.aspx" target="_blank">Please visit this Microsoft official documents:</a></p>
<p><strong>What should be your common practice for SQL Server Security?</strong></p>
<ul>
<li>SQL Server should be hardened after the installation.</li>
<li>After the installation, use the SQL Server Configuration Manager tool in order to disable unnecessary features and services.</li>
<li>Install only required components.</li>
<li>Recent service packs and critical fixes should be installed for SQL Server and Windows.</li>
<li>Windows Authentication mode is more secure than SQL Authentication.</li>
<li>If there is still a need to use SQL Authentication – enforce strong password policy.</li>
<li>Disable the SA account and rename it. Do not use this account for SQL server management.</li>
<li>Change default SQL Server ports associated with the SQL Server installation to keep hackers from port scanning the server.</li>
<li>Hide SQL Server instances or disable the SQL Server Browser service.</li>
<li>Remove BUILDIN\Administrators group from the SQL Server Logins.</li>
<li>Enable logging SQL Server login attempts (failed &amp; successful).</li>
<li>Defining Database Ownership to Increase Security.</li>
<li>Disabling certain system stored procedures.</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-5)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/</link>
					<comments>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 22 Jul 2016 14:06:57 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[deny]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[sql server audit]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[XP_CMDSHELL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3378</guid>

					<description><![CDATA[What do you know about the SQL Server Audit? SQL Server Audit is used to track and log events (not data change) occurring on the SQL Server. SQL Server uses extended events to help create an audit. The audit can be server level or database level. If you create an audit on a database table, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-5)"></a></p><p><strong>What do you know about the SQL Server Audit?</strong></p>
<blockquote><p>SQL Server Audit is used to track and log events (not data change) occurring on the SQL Server. SQL Server uses extended events to help create an audit. The audit can be server level or database level.</p>
<p>If you create an audit on a database table, SQL Server will only track the events that trigger the certain operations (SELECT/INSERT/UPDATE/DELETE) defined in the database audit specification.</p></blockquote>
<p><strong>What options are available to audit login activity?</strong></p>
<ul>
<li>Custom solution with your application to log all logins into a centralized table</li>
<li>Enable login auditing at the instance level in Management Studio</li>
<li>Execute Profiler to capture logins into the instance</li>
<li>Leverage a third party product</li>
</ul>
<p><strong>What is Audit in SQL Server?</strong></p>
<blockquote><p>Auditing an instance of the SQL Server Database Engine or an individual database involves tracking and logging events that occur on the Database Engine.</p></blockquote>
<p><strong>What is Server level Audit specification?</strong></p>
<blockquote><p>You can create one server audit specification per audit.</p>
<p>The server audit specification collects many server-level action groups raised by the Extended Events feature. You can include audit action groups in a server audit specification. Audit action groups are predefined groups of actions, which are atomic events occurring in the Database Engine.</p></blockquote>
<p><strong>What is Database level Audit specification?</strong></p>
<blockquote><p>You can create one database audit specification per SQL Server database per audit.</p>
<p>The database audit specification collects database-level audit actions raised by the Extended Events feature. You can add either audit action groups or audit events to a database audit specification.</p></blockquote>
<p><strong>Is it good to enable Audit only for SQL Server Login fails?</strong></p>
<blockquote><p>Yes:</p>
<p>Database administrators should enable login auditing feature of SQL Server on all instances which they manage. Once this feature is enabled SQL Server will write all the failed and successful login information in SQL Server Error Logs. It is always a best practice to auditing failed SQL Server logins.</p></blockquote>
<p><strong>Does SQL Server Audit require any additional permission?</strong></p>
<blockquote><p>Yes:</p>
<p>Each feature and command for SQL Server Audit has individual permission requirements.</p></blockquote>
<p><strong>Should we encrypt the SQL Server datatabase backups?</strong></p>
<blockquote><p>Yes:</p>
<p>We need to make sure the database backups are encrypted to avoid the misuse.</p></blockquote>
<p><strong>Why we should not use tha SA login for all the different SQL Server access?</strong></p>
<blockquote><p>Because, the sa login and password to all of your SQL Servers because auditing the sa login with a shared password is difficult without capturing the host name or some other personally identifiable data. We should migrate all SQL Server authentication to Windows based authentication.</p></blockquote>
<p><strong>Can I stop a System Admin from enabling SQL Server xp_cmdshell?</strong></p>
<blockquote><p>No:</p></blockquote>
<p><strong>T-SQL script to disable the SA login</strong></p><pre class="crayon-plain-tag">ALTER LOGIN sa DISABLE;</pre><p>
<strong>T-SQL script to rename the SQ login.</strong></p><pre class="crayon-plain-tag">ALTER LOGIN sa WITH NAME = [dbrnd_user];</pre><p>
<strong>Please do auto reset the SA password and disable it.</strong></p>
<blockquote><p>SQL Server has an undocumented system stored procedure named sp_SetAutoSAPasswordAndDisable. This procedure will do exactly as the name suggests: it will reset the password and then disable the &#8216;sa&#8217; login.</p></blockquote>
<pre class="crayon-plain-tag">EXEC sp_SetAutoSAPasswordAndDisable
GO</pre>
<strong>T-SQL script to find common passwords.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE('mssqltips',password_hash)=1;</pre>
<strong>T-SQL script to find blank passwords.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE('',password_hash)=1;</pre>
<strong>T-SQL script to find Passwords that are the same as the Login name.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE(name,password_hash)=1;</pre>
<strong>What is GRANT, DENY and REVOKE?</strong></p>
<blockquote><p>GRANT:gives a user permission to perform certain tasks on database objects.<br />
DENY:denies any access to a user to perform certain tasks on database objects.<br />
REVOKE:removes a grant or deny permission from a user on certain database objects.</p></blockquote>
<p><strong>Sample T-SQL scripts for GRANT, DENY and REVOKE.</strong><br />
<pre class="crayon-plain-tag">GRANT INSERT, UPDATE, SELECT ON Customers TO Joe, Mary;
DENY DELETE ON Customers to Joe, Mary;
REVOKE UPDATE ON Customers to Joe;</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-4)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 21 Jul 2016 21:00:34 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Hashing function]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Symmetric encryption]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[WITH ENCRYPTION OPTION]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3375</guid>

					<description><![CDATA[In our organization we have two teams that stored encrypted data in Microsoft SQL Server. The data is encrypted using symmetric keys and those keys are encrypted with passwords. However, we have a director who needs to be able to see the data for both teams, but we&#8217;d like it so that he only has [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-4%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-hash-function-encrypted-password-symmetric-encryption-with-encryption-option-day-4/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-4)"></a></p><p><strong>In our organization we have two teams that stored encrypted data in Microsoft SQL Server. The data is encrypted using symmetric keys and those keys are encrypted with passwords. However, we have a director who needs to be able to see the data for both teams, but we&#8217;d like it so that he only has to remember one password, preferably separate from the passwords used by the two teams. Is that possible?</strong></p>
<blockquote><p>Yes, it is. Microsoft SQL Server supports the ability for encryption keys to be encrypted via multiple mechanisms. For instance, a symmetric key can be encrypted with a password and an asymmetric key. If you have access to the symmetric key and at least one of those mechanisms, you can open the key.</p></blockquote>
<p><strong>What is hash function?</strong></p>
<blockquote><p>A hash function takes in data and returns back a fixed length block of bits such that any change to the data should result in a different block.</p></blockquote>
<p><strong>What do you know about the HASHBYTES()?</strong></p>
<blockquote><p>HASHBYTES(), as the name implies, is a function or algorithm that generates a hash from some input.</p></blockquote>
<p><strong>Which are the different hashing algorithms?</strong></p>
<blockquote><p>MD2, MD4, MD5, SHA-0, SHA-1, SHA-2</p></blockquote>
<p><strong>What is the main limitation of hasing function?</strong></p>
<blockquote><p>Since a hash function will return a fixed length block, obviously, there are a finite set of possibilities for the output. Therefore, there&#8217;s bound to be different inputs that will result in the same output. We call these situations collisions. What is of concern is if a collision can be engineered fairly quickly/cheaply. This is referred to as a collision attack.</p></blockquote>
<p><strong>What do you know about the Symmetric Encryption Algorithm?</strong></p>
<blockquote><p>This algorithm either take unencrypted data and return encrypted data, or they take encrypted data and return unencrypted data. In order to do so, they use a key, and the key is the same regardless of which direction you go. When it comes to encryption algorithms, symmetric encryption algorithms are substantially faster than asymmetric algorithms.</p></blockquote>
<p><strong>What are the different type of Symmetric Encryption Algorithms?</strong></p>
<ul>
<li>DES (DES)</li>
<li>Triple DES with 128 bit key (TRIPLE_DES)</li>
<li>Triple DES with 192 bit key (DESX)</li>
<li>RC2 (RC2)</li>
<li>RC4 (RC4)</li>
<li>RC4 with 128 bit key (RC4_128)</li>
<li>AES with 128 bit key (AES_128)</li>
<li>AES with 192 bit key (AES_192)</li>
<li>AES with 256 bit key (AES_256)</li>
</ul>
<p><strong>What is your common practice with account SA?</strong></p>
<ul>
<li>Set a hard to guess password.</li>
<li>Rename sa.</li>
<li>Disable sa.</li>
<li>Ensure that no other accounts exist named sa.</li>
</ul>
<p><strong>A user asked how they could get an alert whenever a login failed due to the account being locked out?</strong></p>
<ul>
<li>A SQL Server Agent alert, using the WMI event AUDIT_LOGIN_FAILED</li>
<li>Event Notifications, also using AUDIT_LOGIN_FAILED</li>
<li>Manually consuming the error log</li>
</ul>
<p><strong>How to hide your SQL Server code?</strong></p>
<blockquote><p>The WITH ENCRYPTION clause is used to encrypt the definition of SQL Server objects (views, stored procedures, functions ), so that no one may be able to view the definition/code of that specific object. Using the clause while creating an object is fairly easy.</p></blockquote>
<p><strong>What is the main disadvantage of WITH ENCRYPTION option to hide the SQL Server code?</strong></p>
<blockquote><p>The definition/code of object will not be available to anyone regardless of their permissions or access level. You can not customize the permissions for code/definition visibility.</p>
<p>Once an object has been created on the server using the WITH ENCRYPTION option, there is no standard method provided to get the definition/code back out of the encrypted object. You will need to keep a copy of the code outside of SQL Server.</p></blockquote>
<p><strong>What is the alternative of WITH ENCRYPTION oprtion to secure the SQL Server code?</strong></p>
<blockquote><p>The simple alternative is to granting or revoking View Definition rights.</p>
<p>If permission View Definition is denied for an object to any user then the user would not be able to view the object in SSMS or view.</p></blockquote>
<p><strong>What is a Salt?</strong></p>
<blockquote><p>It is basically something added to whatever we&#8217;re trying to encrypt to make it harder to decrypt the data (two way functions, like symmetric and asymmetric key functions) or find a collision (one way functions, AKA hash functions). The salt should be potentially different for every single piece of encrypted data. The salt should be randomly generated.</p></blockquote>
<p><strong>What will you do if you lost rights of your SQL Server instance?</strong></p>
<ul>
<li>Dedicated Administrator Connection</li>
<li>BUILIN\Administrator Group (Incase its rights are not revoked)</li>
<li>Final Option is to change the registry value</li>
<li>You can change authentication mode via registry</li>
</ul>
<p><strong>What is the difference between sysadmin and serveradmin server role?</strong></p>
<blockquote><p><strong>sysadmin:</strong> Members of the sysadmin fixed server role can perform any activity in the server.</p>
<p><strong>serveradmin:</strong> Members of the serveradmin fixed server role can change server-wide configuration options and shut down the server.</p></blockquote>
<p><strong>How to check SA login related information?</strong><br />
<pre class="crayon-plain-tag">USE Master
GO
SELECT sid, [name], createdate, updatedate
FROM master.dbo.syslogins
WHERE [name] = 'sa'
GO</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-3)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 20 Jul 2016 04:24:20 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[authentication mode]]></category>
		<category><![CDATA[Change Data Capture CDC]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[password policy]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SA Account]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[trustworthy]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3372</guid>

					<description><![CDATA[What do you know about the Change Data Capture (CDC)? Change Data Capture (CDC) is used to track the changed data caused by common DML operations (INSERT/UPDATE/DEKLETE). The capture process reads the transaction log to pull out the data change information and then load the information into the associated change table. How to disable change [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-3%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-change-data-capture-cdc-guest-user-sa-password-trustworthy-day-3/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-3)"></a></p><p><strong>What do you know about the Change Data Capture (CDC)?</strong></p>
<blockquote><p>Change Data Capture (CDC) is used to track the changed data caused by common DML operations (INSERT/UPDATE/DEKLETE). The capture process reads the transaction log to pull out the data change information and then load the information into the associated change table.</p></blockquote>
<p><strong>How to disable change data capture (CDC) on a table?</strong></p><pre class="crayon-plain-tag">USE Your_Database_Name
GO
EXEC sys.sp_cdc_disable_table
@source_schema = N'dbo',
@source_name = N'YourTableName',
@capture_instance = N'dbo_YourTableName'
GO</pre><p>
<strong>How to check if Change Data Capture is enabled or disabled on a SQL Server Database?</strong></p><pre class="crayon-plain-tag">SELECT [name], is_cdc_enabled
FROM sys.databases where name = 'Database_Name'
/*
is_cdc_enabled = 0 -- CDC is disabled
is_cdc_enabled = 1 -- CDC is enabled
*/</pre><p>
<strong>How to Restore Database On Which Change Data Capture (CDC) Is Enabled?</strong></p>
<blockquote><p>When we restore a database from a CDC enabled database backup, it does not restore the CDC object automatically. Also if you try to look for some options for Restore with CDC object etc. in Database Restore Wizard, you would not find anything.</p>
<p>If we restore the database on the same SQL Server instance with same name, CDC objects will be restored and it will start working fine as CDC jobs are available on the server already.</p>
<p>If you try to restore with a different name or restore to different SQL Server instance, It will not restore CDC objects by default. In Restore Database statement, we have to include Keep_CDC.</p></blockquote>
<p><strong>What is the Guest user account in SQL Server?  What login is it mapped to it?</strong></p>
<blockquote><p>The Guest user account is created by default in all databases and is used when explicit permissions are not granted to access an object.  It is not mapped directly to any login, but can be used by any login.</p></blockquote>
<p><strong>How can SQL Server instances be hidden?</strong></p>
<blockquote><p>To hide a SQL Server instance, we need to make a change in SQL Server Configuration Manager. To do this launch SQL Server Configuration Manager and do the following: select the instance of SQL Server, right click and select Properties.</p>
<p>After selecting properties you will just set Hide Instance to &#8220;Yes&#8221; and click OK or Apply. After the change is made, you need to restart the instance of SQL Server to not expose the name of the instance.</p></blockquote>
<p><strong>Is it possible to disable SA, how?</strong></p>
<blockquote><p>Disable the SA Login</p>
<p>Disabling the SA account is a good option to prevent its use. When it is disabled no one can use it in any circumstance until it is enabled.</p></blockquote>
<p><strong>What is the difference between Authenticate and Authorization?</strong></p>
<blockquote><p>When you log on to a PC with a user name and password you are authenticating. Authorization is the process of verifying that you have access to something. Gaining access to a resource (e.g. directory on a hard disk) because the permissions configured on it allow you access is authorization.</p></blockquote>
<p><strong>Which one is highest privileged role out of SQLAgentUserRole, SQLAgentReaderRole, SQLAgentOperatorRole?</strong></p>
<blockquote><p>SQLAgentOperatorRole is the most privileged of the SQL Server Agent fixed database roles. It includes all the permissions of SQLAgentUserRole andSQLAgentReaderRole. Members of this role can also view properties for operators and proxies, and enumerate available proxies and alerts on the server.</p></blockquote>
<p><strong>What is the password policy for SQL Server Accounts?</strong></p>
<ul>
<li>The password must contain uppercase &amp; lowercase letters.</li>
<li>The password must contain numbers &amp; alphanumeric characters.</li>
<li>The password must contain non-alphanumeric characters such as &amp;, ^,%,*,$ etc.</li>
<li>Do not use common known passwords that are easy to guess such as: admin, password, sa, administrator, sysadmin etc.</li>
<li>Passwords should be long enough (at least 8 characters long).</li>
<li>It does not allows blank password for the SA account.</li>
</ul>
<p><strong>What are the disadvantages of SQL Server Authentication Mode?</strong></p>
<blockquote><p>If a user is a Windows domain user who has a login and password for Windows, he must still provide another (SQL Server) login and password to connect. Keeping track of multiple names and passwords is difficult for many users. Having to provide SQL Server credentials every time that one connects to the database can be annoying.</p>
<p>SQL Server Authentication cannot use Kerberos security protocol.</p>
<p>Windows offers additional password policies that are not available for SQL Server logins.</p>
<p>The encrypted SQL Server Authentication login password, must be passed over the network at the time of the connection. Some applications that connect automatically will store the password at the client. These are additional attack points.</p></blockquote>
<p><strong>When CHECK_POLICY is ON, what kind of behavior occur?</strong></p>
<blockquote><p>CHECK_EXPIRATION is also set to ON unless it is explicitly set to OFF.</p>
<p>The password history is initialized with the value of the current password hash.</p>
<p>Account lockout duration, account lockout threshold, and reset account lockout counter after are also enabled.</p></blockquote>
<p><strong>What is What is TRUSTWORTHY database?</strong></p>
<blockquote><p>Applies To: SQL Server 2016.</p>
<p>The TRUSTWORTHY database property is used to indicate whether the instance of SQL Server trusts the database and the contents within it. By default, this setting is OFF, but can be set to ON by using the ALTER DATABASE statement.</p>
<p>This property can be used to reduce certain threats that can exist as a result of attaching a database.</p></blockquote>
<p><strong>Where are the places that I should not use the sa login?</strong></p>
<ul>
<li>Embedded in management tools or application development tools</li>
<li>Hard coded in application connection strings</li>
<li>DTS or SSIS connection objects</li>
<li>UDL files</li>
<li>Batch files</li>
<li>SQLCMD, OSQL or ISQL T-SQL scripts</li>
<li>In casual conversation</li>
<li>On sticky notes on your desk or monitor</li>
</ul>
<p><strong>What is the use of BUILTIN\Administrators Group in SQL Server?</strong></p>
<blockquote><p>Any Windows login in BUILTIN\Administrators group is by default a SQL Server system administrator. This single group can be used to manage administrators from a Windows and SQL Server perspective.</p></blockquote>
<p><strong>How to detect Orphaned Users in SQL Server?</strong><br />
<pre class="crayon-plain-tag">SELECT dp.type_desc, dp.SID, dp.name AS user_name
FROM sys.database_principals AS dp
LEFT JOIN sys.server_principals AS sp
ON dp.SID = sp.SID
WHERE sp.SID IS NULL
AND authentication_type_desc = 'INSTANCE';</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server Database Administrator Interview Questions and Answers (Day-9)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9/</link>
					<comments>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 17 Jul 2016 07:39:14 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[fragmentation]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[Service Broker]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3352</guid>

					<description><![CDATA[What is the use of Service Broker? Service Broker helps developers build asynchronous, loosely coupled applications in which independent components work together to accomplish a task. These application components exchange messages that contain the information that is required to complete the task. Service Broker can be useful for any application that needs to perform processing [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9%2F&#038;title=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-9%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9/" data-a2a-title="SQL Server Database Administrator Interview Questions and Answers (Day-9)"></a></p><p><strong>What is the use of Service Broker?</strong></p>
<blockquote><p>Service Broker helps developers build asynchronous, loosely coupled applications in which independent components work together to accomplish a task. These application components exchange messages that contain the information that is required to complete the task.</p>
<p>Service Broker can be useful for any application that needs to perform processing asynchronously, or that needs to distribute processing across a number of computers.</p></blockquote>
<p><strong>What are the main components of Service Broker?</strong></p>
<ul>
<li><strong>Conversation components:</strong> Conversation groups, conversations, and messages form the run-time structure of a Service Broker application. Applications exchange messages as part of a conversation.</li>
<li><strong>Service definition components:</strong> These are design-time components that specify the basic structure of the conversations that the application uses.</li>
<li><strong>Networking and security components:</strong> These components define the infrastructure used to exchange messages between instances of the Database Engine. To help database administrators manage</li>
<li><strong>Changing environments:</strong> Service Broker lets administrators configure these components independently of the application code.</li>
</ul>
<p><strong>What are the advantages of Service Broker?</strong></p>
<blockquote><p>Database integration enhances application performance and simplifies administration.</p>
<p>Message ordering and coordination for simplified application development</p>
<p>Loose application coupling provides workload flexibility.</p>
<p>Related message locking allows more than one instance of an application to process messages from the same queue without explicit synchronization.</p>
<p>Automatic activation allows applications to scale with the message volume.</p></blockquote>
<p><strong>I have a database which has several tables that have very heavy write operations. These table are very large and some are over a hundred gigabytes. I noticed performance of this database is getting slower and after some investigation we suspect that the Auto Update Statistics function is causing a performance degradation.</strong></p>
<p><strong>What should be your solution of this problem?</strong></p>
<blockquote><p>Statistics are objects which contain information about the distribution of values in one or more columns of a table or indexed view. The query optimizer uses this statistical data to estimate the number of rows in the query result. In the case where the statistics are invalid or outdated then the query optimizer is likely to choose a wrong execution plan and query performance will decrease. Therefore keeping statistics up to date is an essential part of SQL Server maintenance.</p>
<p>If we experience problems due to statistics automatically being updated then the solution might be to disable the Auto Update Statistics option. However, we cannot live with outdated statistics on large databases, so if you turn this option off you should create a scheduled job which explicitly updates the statistics during off-peak periods. To do this, we can use the sp_updatestats procedure.</p></blockquote>
<p><strong>What are the different type of Fragmentations?</strong></p>
<ul>
<li>Logical/Phsical Disk Fragmentation</li>
<li>Extent Fragmentation</li>
<li>File Fragmentation</li>
<li>Page Fragmentation</li>
<li>Index Fragmentation</li>
</ul>
<p><strong>What are the index statistics?</strong></p>
<blockquote><p>Index statistics contain information about the distribution of index key values. By distribution, I mean the number of rows associated with each key value. SQL Server uses this information to determine what kind of execution plan to use when processing a query.</p></blockquote>
<p><strong>When are index statistics updated?</strong></p>
<blockquote><p>The AUTO_UPDATE_STATISTICS database setting controls when statistics are automatically updated.  Once statistics have been created, SQL Server then determines when to update those statistics based on how out-of-date the statistics might be.</p>
<p>SQL Server identifies out of date statistics based on the number of inserts, updates, and deletes that have occurred since the last time statistics were updated, and then recreates the statistics based on a threshold. The threshold is relative to the number of records in the table. (Enable the properties – “auto create statistics” and “auto update statistics” for OLTP)</p></blockquote>
<p><strong>Explain database options “Auto Update Statistics” and “Auto Update Statistics Asynchronous”?</strong></p>
<blockquote><p>Auto Update Statistics: If there is an incoming query but statistics are stale then sql server first update the statistics before building the execution plan.</p>
<p>Auto Update Statistics Asynchronous: If there is an incoming query but statistics are stale then sql servers uses the stale statistics, builds the execution plan and then update the statistics.</p></blockquote>
<p><strong>How to update statistics manually?</strong></p>
<blockquote><p>If you want to manually update statistics, you can use either sp_updatestats or UPDATE STATISTICS &lt;statistics name&gt;</p></blockquote>
<p><strong>What are the various types of statistics available?</strong></p>
<p>There are three different types of statistics available.</p>
<ul>
<li>Statistics created due to index creation.</li>
<li>Statistics created by optimizer.</li>
<li>User defined statistics created from “CREATE STATISTICS”</li>
</ul>
<p><strong>What are the various options to be considered while designing a new execution plan?</strong></p>
<blockquote><p>There are a number of factors that influence the decision in choosing the proper execution plan. One of the most important ones are cardinality estimations, the process of calculating the number of qualifying rows that are likely after filtering operations are applied.</p>
<p>A query execution plan selected with inaccurate cardinality estimates can perform several orders of magnitude slower than one selected with accurate estimates. These cardinality estimations also influence plan design options, such as join-order and parallelism. Even memory allocation, the amount of memory that a query requests, is guided by cardinality estimations.</p></blockquote>
<p><strong>How to find out when statistics updated last time?</strong></p>
<blockquote><p>A simple logic is, run the query and observe the values for both “estimated rows” and “actual rows”, if they both are close to each other you need not worried about the statistics. If you find big difference between them then you need to think about updating statistics.</p>
<p>In general we can find out last statistics updated info from below query</p><pre class="crayon-plain-tag">select object_name(object_id) as table_name
,name as stats_name
,stats_date(object_id, stats_id) as last_update
from sys.stats
where objectproperty(object_id, ‘IsUserTable’) = 1
order by last_update</pre><p>
</p></blockquote>
<p><strong>What are the statistics in SQL Server?</strong></p>
<blockquote><p>Statistics determine the selectivity of the indexes. If an indexed column has unique values then the selectivity of that index is more, as opposed to an index with non-unique values. Query optimizer uses these indexes in determining whether to choose an index or not while executing a query.</p></blockquote>
<p><strong>In which situation you should update statistics?</strong></p>
<blockquote><p>If there is significant change in the key values in the index</p>
<p>If a large amount of data in an indexed column has been added, changed, or removed (that is, if the distribution of key values has changed), or the table has been truncated using the TRUNCATE TABLE statement and then repopulated</p>
<p>Database is upgraded from a previous version.</p></blockquote>
<p><strong>What are the steps to improve the performance of a query?</strong></p>
<ul>
<li>Number of joins and use of complex views/cursors have to be reduced.</li>
<li>The use of the stored procedures and indexes have to be maximized.</li>
<li>The optimized use of the complex conditional checks and computer columns have to be in place.</li>
<li>Tracking of performance analysis for the query helps us in identifying the right aspects to optimize.</li>
</ul>
<p><strong>Could you please give some Optimization Tips in writing SQL Queries ?</strong></p>
<ul>
<li>Always try to use views and stored procedures instead of doing work with heavy queries.</li>
<li>Make a habit to use constraints instead of triggers whenever it is possible.</li>
<li>When you need n number of row from database try to use top keyword or SET ROWCOUNT statement</li>
<li>Always use table variables in place of temporary tables.</li>
<li>Avoid Union and try to use UNION ALL statement.</li>
<li>Always avoid using the DISTINCT clause, whenever possible.</li>
<li>Always try to avoid using SQL Server cursors.</li>
<li>Always try to avoid the HAVING clause.</li>
<li>Do not use select count(*) to get number of rows</li>
<li>Try to include SET NOCOUNT ON statement into your stored procedures to stop the message indicating the number of rows affected by a T-SQL statement.</li>
<li>Always use file system to store large binary objects and use the file path in database.</li>
<li>Sometimes we may have to apply more than one sub queries in our main query. Try to minimize the number of sub query block in your query</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-service-broker-performance-statistics-fragmentations-day-9/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server Database Administrator Interview Questions and Answers (Day-8)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 16 Jul 2016 07:33:51 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[cpu affinity]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbcc]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[Resource Database]]></category>
		<category><![CDATA[Shrinking database]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3348</guid>

					<description><![CDATA[&#160; Does SQL Server reuses space to accommodate new data, When we delete variable length column or rows? Whenever rows or columns are deleted from a table, SQL Server reuses space to accommodate new data. However, this is not the case when a variable length column is deleted. The space used by this type of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8%2F&#038;title=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-8%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-shrink-resource-database-sql-injection-cpu-affinity-dbcc-day-8/" data-a2a-title="SQL Server Database Administrator Interview Questions and Answers (Day-8)"></a></p><p>&nbsp;</p>
<p><strong>Does SQL Server reuses space to accommodate new data, When we delete variable length column or rows?</strong></p>
<blockquote><p>Whenever rows or columns are deleted from a table, SQL Server reuses space to accommodate new data.</p>
<p>However, this is not the case when a variable length column is deleted.</p>
<p>The space used by this type of column is not reclaimed automatically.</p>
<p>Variable length columns can be of data types varchar, nvarchar, varchar(max), nvarchar(max), varbinary, varbinary(max), text, ntext, image, sql_variant, and xml.</p></blockquote>
<p><strong>As a DBA, what should be your daily checklist for Database Server?</strong></p>
<ul>
<li>Check status of backups</li>
<li>Review the nightly run processes</li>
<li>Check the error log files</li>
<li>Check the windows error log files</li>
<li>Check the status of SQL Agent jobs</li>
<li>Review the performance related report of SQL Server</li>
<li>Check the storage information</li>
<li>Review the configured Service broker</li>
<li>Indentify the different type of fragmentations</li>
</ul>
<p><strong>How to recycle SQL Server Agent Error logs?</strong></p>
<blockquote><p>We can use sp_cycle_agent_errorlog system procedure to recycle SQL Server Agent Error logs.</p>
<p>When we cycle the error logs it is easier to open up a SQL Server Agent Error Log file when it is smaller in size.</p></blockquote>
<p><strong>What is a Scheduled Jobs or What is a Scheduled Tasks?</strong></p>
<blockquote><p>Scheduled tasks let user automate processes that run on regular or predictable cycles. User can schedule administrative tasks, such as cube processing, to run during times of slow business activity.</p>
<p>User can also determine the order in which tasks run by creating job steps within a SQL Server Agent job. E.g. back up database, Update Stats of Tables. Job steps give user control over flow of execution. If one job fails, user can configure SQL Server Agent to continue to run the remaining tasks or to stop execution.</p></blockquote>
<p><strong>What should be your recommendations for Shrinking a database?</strong></p>
<blockquote><p>Shrink the file by using Truncate Only: First it removes the inactive part of the log and then perform shrink operation.</p>
<p>Rebuild / Reorganize the indexes once the shrink is done so the Fragmentation level is decreased.</p></blockquote>
<p><strong>What are the different type of log files?</strong></p>
<ul>
<li>SQL Server Error Log</li>
<li>SQL Server Agent Log</li>
<li>Windows Event Log</li>
<li>SQL Server Setup Log</li>
<li>SQL Server Profiler Log</li>
</ul>
<p><strong>How many datafiles I can put in Tempdb? What is the effect of adding multiple data files?</strong></p>
<blockquote><p>The most effective configuration is to set tempdb on its own separate fast drive away from the user databases. I would set the number of files based on # of cpu’s divided by 2.</p></blockquote>
<p><strong>Which trace flag is used to find log record for SQL Server connection?</strong></p>
<blockquote><p>trace flag number: 4013</p></blockquote>
<p><strong>What do you know about the resource database?</strong></p>
<blockquote><p>All sys objects are physically stored in resource database and logically available on every database.</p>
<p>Resource database can faster the service packs or upgrades.</p></blockquote>
<p><strong>Why can&#8217;t I view the list of databases, tables, views in the SQL ServerManagement Studio Object Explorer?</strong></p>
<blockquote><p>This issue is due to not having VIEW DEFINITION permission on the specific object.</p>
<p>To resolve this issue, you need to grant VIEW DEFINITION permission on the object to the user which is mapped to the login you used.</p>
<p>You can perform this by running the following Transact-SQL.</p><pre class="crayon-plain-tag">USE database_name;
GO
GRANT VIEW DEFINITION ON [object_name] TO
[database_user/database_role]</pre><p>
</p></blockquote>
<p><strong>Can we initiate a external COM object from within SQL?</strong></p>
<blockquote><p>Yes: we can use the stored procedure sp_OACreate to initiate the external COM object from the T-SQL.</p></blockquote>
<p><strong>What sp_MSforeachtable  does ?</strong></p>
<blockquote><p>You can use sp_MSforeachtable undocumented stored procedure to rebuild all indexes in your database.</p>
<p>Try to schedule it to execute during CPU idle time and slow production periods.</p></blockquote>
<p><strong>What will you do if you lost rights of your SQL Server instance?</strong></p>
<blockquote><p>We can use the below options:</p>
<ul>
<li>Dedicated Administrator Connection</li>
<li>BUILIN\Administrator Group (Incase its rights are not revoked)</li>
<li>Final Option is to change the registry value</li>
<li>You can change authentication mode via registry</li>
</ul>
</blockquote>
<p><strong>What is SQL Injection?</strong></p>
<blockquote><p>SQL Injection is developed where unhandled\unexpected SQL commands are passed to SQL Server in a malicious manner. It is a problem because unknowingly data can be stolen, deleted, updated, inserted or corrupted.</p></blockquote>
<p><strong>What is CPU Affinity?</strong></p>
<blockquote><p>CPU Affinity sometimes refers as CPU pinning enables a particular process or a thread to use one or more Central Processing Unit, it depends upon the number of CPU configured in your system. It enables particular thread or process to use only configured CPU rather than any CPU that&#8217;s configured in your Operating system.</p></blockquote>
<p><strong>As a part of your job, what are the DBCC commands that you commonly use for database maintenance?</strong></p>
<ul>
<li>DBCC CACHESTATS &#8211; Displays information about the objects currently in the buffer cache.</li>
<li>DBCC CHECKDB &#8211; This will check the allocation of all pages in the database as well as check for any integrity issues.</li>
<li>DBCC CHECKTABLE &#8211; This will check the allocation of all pages for a specific table or index as well as check for any integrity issues.</li>
<li>DBCC DBREINDEX &#8211; This command will reindex your table. If the indexname is left out then all indexes are rebuilt. If the fillfactor is set to 0 then this will use the original fillfactor when the table was created.</li>
<li>DBCC PROCCACHE &#8211; This command will show you information about the procedure cache and how much is being used. Spotlight will also show you this same information.</li>
<li>DBCC MEMORYSTATUS &#8211; Displays how the SQL Server buffer cache is divided up, including buffer activity.</li>
<li>DBCC SHOWCONTIG &#8211; This command gives you information about how much space is used for a table and indexes. Information provided includes number of pages used as well as how fragmented the data is in the database.</li>
<li>DBCC SHOW_STATISTICS &#8211; This will show how statistics are laid out for an index. You can see how distributed the data is and whether the index is really a good candidate or not.</li>
<li>DBCC SHRINKFILE &#8211; This will allow you to shrink one of the database files. This is equivalent to doing a database shrink, but you can specify what file and the size to shrink it to. Use the sp_helpdb command along with the database name to see the actual file names used.</li>
<li>DBCC SQLPERF &#8211; This command will show you much of the transaction logs are being used.</li>
<li>DBCC TRACEON &#8211; This command will turn on a trace flag to capture events in the error log. Trace Flag 1204 captures Deadlock information.</li>
<li>DBCC TRACEOFF &#8211; This command turns off a trace flag.</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server Database Administrator Interview Questions and Answers (Day-7)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 15 Jul 2016 07:31:03 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[archive table]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[DBCC CHECKPRIMARYFILE]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Dedicated Connection]]></category>
		<category><![CDATA[Instance Aware]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[Multiple file groups]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3345</guid>

					<description><![CDATA[What is the Instance-aware and Instance-unaware services in SQL Server? Instance-aware services are associated with a specific instance of SQL Server. SQL Server SQL Server Agent Analysis Services Reporting Services Full-text search Instance-unaware services are shared among all installed SQL Server instances. Integration Services SQL Server Browser SQL Server Active Directory Helper SQL Writer What [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7%2F&#038;title=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-7%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-instance-aware-archive-option-dbcc-checkprimaryfile-dedicated-connection-day-7/" data-a2a-title="SQL Server Database Administrator Interview Questions and Answers (Day-7)"></a></p><p><strong>What is the Instance-aware and Instance-unaware services in SQL Server?</strong></p>
<p>Instance-aware services are associated with a specific instance of SQL Server.</p>
<ul>
<li>SQL Server</li>
<li>SQL Server Agent</li>
<li>Analysis Services</li>
<li>Reporting Services</li>
<li>Full-text search</li>
</ul>
<p>Instance-unaware services are shared among all installed SQL Server instances.</p>
<ul>
<li>Integration Services</li>
<li>SQL Server Browser</li>
<li>SQL Server Active Directory Helper</li>
<li>SQL Writer</li>
</ul>
<p><strong>What should be your priliminary questions for Data Archive in SQL Server?</strong></p>
<ul>
<li>What types of data are we storing?</li>
<li>Most effective storage approach for our users &#8211; how often are they accessing/needing these data?</li>
<li>Most effective storage approach for our environment &#8211; what is our environments bottlenecks, limitations and weaknesses and strengths in structure?</li>
<li>Most effective storage approach when considering legal restrictions and requirements.</li>
<li>Most effective storage approach when we consider costs; for an example, do we need an Enterprise license for our data archived server?</li>
</ul>
<p><strong>What are your different suggestions for archiving data?</strong></p>
<blockquote><p><strong>If the data needs to reside in the same database:</strong></p>
<p>Move the archive data to separate table(s) with a prefix to denote the tables are archive related such as &#8216;arc_&#8217;.</p>
<p>Create the table(s) in separate filegroups on separate disks to improve IO performance.</p>
<p>Use a view to join the old and new data if the users continue to need to access the data.</p>
<p>Modify the front end code to use the view rather than the base table.</p>
<p><strong>If the data does not need to reside in the same database:</strong></p>
<p>Move (insert and delete) the archive data to separate table(s) in another database on the server or to a separate database on another server.</p>
<p>Have users request access to the data for specific queries or change the application to use a linked server to access the archived data.</p>
<p><strong>If the data is just not needed:</strong></p>
<p>Back up the data, verify the backup is restorable, note the date of the last backup with the archived data and just delete the data.</p>
<p><strong>Automation options:</strong></p>
<p>Based on the application find out if the vendor has already implemented an archiving feature that just needed to be enabled.</p>
<p>If an automated option is not available, build a process with DTS or SSIS to move the data from the source system to the archive system.</p></blockquote>
<p><strong>What is the use of DBCC CHECKPRIMARYFILE?</strong></p>
<blockquote><p>DBCC CHECKPRIMARYFILE is one of the many undocumented SQL Server commands that we can use to do our job as DBAs.</p>
<p>This command is used only for reading meta data from the primary database data file on disk and to return information that is very useful, such as the database name, logical names, physical file names and more without having to attach it to an instance of SQL Server.</p></blockquote>
<p><strong>When you attach a database in SQL Server 2008R2 which was detached by a user with a different login you may get this error:</strong></p>
<p><strong>CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file&#8230;</strong></p>
<p><strong>The question is, why this is occured and what is the solution of this?</strong></p>
<blockquote><p>You get this error because two different logins did the detach and attach operations. So the files, when detached, were owned by the first login, but the attach failed because the login that was used was not the owner of the mdf and ldf files.</p>
<p>When we detach database files, the owner becomes the person who did the detach command, so to resolve the issue we need to change or add the other login as the owner of the mdf and ldf files.</p></blockquote>
<p><strong>Can we make dedicated connection for Database Administrator?</strong></p>
<blockquote><p>Yes: using Dedicated Administrator Connection (DAC).</p>
<p>SQL Server Database Administrator can connect to a SQL Server Instance when the database engine is not responding to regular connections. During such a scenario a DBA can connect to the SQL Server Instance to troubleshoot and to kill any of the SQL Server Processes which are causing the issues.</p></blockquote>
<p><strong>Can we move data files between filegroups?</strong></p>
<blockquote><p>we cannot move data files between filegroups, it is a common practice to move data for a table between filegroups in a database.</p>
<p>This is a straight forward method of moving data from a table from one filegroup to another. We can recreate\create the clustered index on the new filegroup thereby moving the data from one filegroup to another.</p></blockquote>
<p><strong>When should I start thinking about using multiple file groups?</strong></p>
<ul>
<li>When disk queuing is causing application and user experience issues.</li>
<li>When particular tables are 10% or more of the database.</li>
<li>When non clustered index and data space are equal on large tables.</li>
<li>When an almost equal percentage of read-only and read-write data exist in the database.</li>
<li>When insufficient time is available to perform database maintenance.</li>
<li>When the business or application will be changing significantly and the data is going to grow at a much higher rate.</li>
<li>When archived data resides in the same database as the production data.</li>
</ul>
<p><strong>How to determine the service pack currently installed on SQL Server?</strong></p>
<blockquote><p>The global variable @@Version stores the build number of the sqlservr.exe, which is used to determine the service pack installed.</p></blockquote>
<p><strong>Why can’t I track data changes even though I already enabled the database audit on my database?</strong></p>
<blockquote><p>Database Audit does not track data changes. To track the data changes, you need to use another feature named &#8220;Change Data Capture&#8221; (CDC).</p></blockquote>
<p><strong>How do you troubleshoot errors in a SQL Server Agent Job?</strong></p>
<blockquote><p>Inside SSMS, in Object explorer under SQL Server Agent look for Job Activity Monitor. The job activity monitor displays the current status of all the jobs on the instance. Choose the particular job which failed, right click and choose view history from the drop down menu.</p></blockquote>
<p><strong>What is RAID and what are different types of RAID configurations?</strong></p>
<blockquote><p>RAID stands for Redundant Array of Inexpensive Disks, used to provide fault tolerance to database servers. There are six RAID levels 0 through 5 offering different levels of performance, fault tolerance.</p></blockquote>
<p><strong>Why can&#8217;t I log on to SQL Server using Windows Authentication in SQL Server Management Studio?</strong></p>
<blockquote><p>If you want to log on to the server using Windows Authentication, ensure that the current Windows account has been added to server logins.</p>
<p>You can check using below T-SQL.</p><pre class="crayon-plain-tag">SELECT loginname FROM sys.syslogins;</pre><p>
</p></blockquote>
<p><strong>What are the different ways of moving data/databases between servers and databases in SQL Server?</strong></p>
<blockquote><p>There are lots of options available, you have to choose your option depending upon your requirements. Some of the options you have are: BACKUP/RESTORE, dettaching and attaching databases, replication, DTS, BCP, logshipping, INSERT…SELECT, SELECT…INTO, creating INSERT scripts to generate data.</p></blockquote>
<p><strong>How To Find When SQL Server Instance was Started Last Time?</strong><br />
<pre class="crayon-plain-tag">SELECT sqlserver_start_time FROM sys.dm_os_sys_info</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server Database Administrator Interview Questions and Answers (Day-6)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 14 Jul 2016 20:59:17 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[browser service]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[collation]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[model database]]></category>
		<category><![CDATA[msdtc]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[udp port]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3335</guid>

					<description><![CDATA[What is the main role of Model Database in SQL Server? The model database, as its name implies, serves as the model (or template) for all databases created on the same instance. If the model database is modified, all subsequent databases created on that instance will pick up those changes, but earlier created databases will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6%2F&#038;title=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-6%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-model-database-collation-msdtc-udp-browser-service-day-6/" data-a2a-title="SQL Server Database Administrator Interview Questions and Answers (Day-6)"></a></p><p><strong>What is the main role of Model Database in SQL Server?</strong></p>
<blockquote><p>The model database, as its name implies, serves as the model (or template) for all databases created on the same instance. If the model database is modified, all subsequent databases created on that instance will pick up those changes, but earlier created databases will not. Note that TEMPDB is also created from model every time SQL Server starts up.</p></blockquote>
<p><strong>What is a collation in SQL Server?</strong></p>
<blockquote><p>Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width.</p></blockquote>
<p><strong>What is Use of @@ SPID in SQL Server?</strong></p>
<blockquote><p>A SPID is the returns sessions ID of the current user process. And using that session ID, we can find out that the last query was executed.</p></blockquote>
<p><strong>What is cloud computing?</strong></p>
<blockquote><p>Cloud computing is a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.</p></blockquote>
<p><strong>How do I rename my SQL Server instance?</strong></p>
<blockquote><p>SQL Server doesn&#8217;t support renaming the instance name directly so you can uninstall the existed instance and install it with the new name and change the computer name and rename the part of the instance name that corresponds to the computer name.</p></blockquote>
<p><strong>How do I store data in multiple languages within one database?</strong></p>
<blockquote><p>The easiest way to manage character data in international databases is to always use the Unicode nchar, nvarchar, and nvarchar(max) data types, instead of their non-Unicode equivalents, char, varchar, and text. Unicode is a standard for mapping code points to characters.</p></blockquote>
<p><strong>How do I configure SQL Server to enable distributed transactions via Linked Server?</strong></p>
<blockquote><p>To enable distributed transactions across different servers, you need to configure MS DTC on both servers and some of your SQL Server server options.</p>
<p>Please run &#8220;services.msc&#8221; from windows run dialog to check DTC service is running or not.</p>
<p>Please make sure this service could access the network and could receive connection from other server.</p>
<p>Please enable the XACT_ABORT.</p></blockquote>
<p><strong>What is recompilation?</strong></p>
<blockquote><p>When the cached execution plan for a query cannot be used so the procedure recompiles.</p></blockquote>
<p><strong>How do I configure Windows Firewall to allow remote connections using TCP/IP protocol for SQL Server?</strong></p>
<blockquote><p>On the server on which SQL Server runs, we need to find out which ports that SQL Server is listening and add which to Windows Firewall Inbound Exceptions.</p>
<p>Firstly, we need to add TCP port on which SQL Server service is listening to the Windows Firewall Inbound Exceptions so that the client can make connections to SQL Server over Windows Firewall.</p>
<p>Secondly, if we do not specify TCP port in the connection string and SQL Server is not listening on the TCP 1433 port, we need to add UDP 1434 port on which SQL Server Browser Services is listening to the Windows Firewall Inbound Exceptions.</p></blockquote>
<p><strong>What is parallelism?</strong></p>
<blockquote><p>SQL Server can perform a query or index operation in parallel by using several operating system threads, the operation can be completed quickly. When a single query runs of multiple CPUs is known as query parallelism.</p></blockquote>
<p><strong>What is the default query threshold for parallelism?</strong></p>
<blockquote><p>The query optimizer decides to utilize multiple SPIDS running on different processors to query / transfer data. Default threshold is 5 seconds.</p></blockquote>
<p><strong>How to start the SQL Server with minimal configuration?</strong></p>
<blockquote><p>If there are any configuration problems that prevent the server from starting, you can start an instance of Microsoft SQL Server by using the minimal configuration startup option. This is the startup option -f.  Starting an instance of SQL Server with minimal configuration automatically puts the server in single-user mode.</p></blockquote>
<p><strong>What is auto close option?</strong></p>
<blockquote><p>AUTO CLOSE option:</p>
<p>When set to ON, the database is shut down cleanly and its resources are freed after the last user exits. The database automatically reopens when a user tries to use the database again.</p>
<p>When set to OFF, the database remains open after the last user exits.</p></blockquote>
<p><strong>What do you know about the MSDTC service?</strong></p>
<blockquote><p>MSDTC (aka Microsoft Distributed Transaction Control) is a piece of software which a lot of people use, but they don&#8217;t really know what it does, or how it works. MSDTC is used by SQL Server and other applications when they want to make a distributed transaction between more than one machine.</p></blockquote>
<p><strong>What do you know about the port UDP 1434?</strong></p>
<blockquote><p>UDP port 1434 is used for SQL Server named instances. The SQL Server Browser service listens on this port for incoming connections to a named instance. The service then responds to the client with the TCP port number for the requested named instance.</p></blockquote>
<p><strong>What do you know about the SQL Server Browser Service?</strong></p>
<blockquote><p>While commonly thought of as “one of those other SQL Server services”, life without the SQL Server Browser Service would be a bit more of a hassle. Its main purpose is to aid in the detection of SQL Server instances and provide information necessary for connecting to them.  It listens on UDP port 1434 and returns port numbers and version information for requested instances on a machine.</p>
<p>When a user connects to the default instance, the connection is passed to TCP 1433 automatically.  When connecting to a named instance and the port number is unknown, the first connection made is to the Browser Service at UDP 1434, which then returns the proper port number on which to initiate the TCP connection.</p></blockquote>
<p><strong>What is the Instance-aware and Instance-unaware services in SQL Server?</strong></p>
<p>Instance-aware services are associated with a specific instance of SQL Server.</p>
<ul>
<li>SQL Server</li>
<li>SQL Server Agent</li>
<li>Analysis Services</li>
<li>Reporting Services</li>
<li>Full-text search</li>
</ul>
<p>Instance-unaware services are shared among all installed SQL Server instances.</p>
<ul>
<li>Integration Services</li>
<li>SQL Server Browser</li>
<li>SQL Server Active Directory Helper</li>
<li>SQL Writer</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server Database Administrator Interview Questions and Answers (Day-5)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 13 Jul 2016 20:42:03 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database offline]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dynamic management views]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[sql azure]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3332</guid>

					<description><![CDATA[List out Dynamic Management Views (DMV&#8217;s) and the value that they provide to developers or DBAs. dm_tran_locks &#8211; Locking and blocking. dm_clr_loaded_assemblies &#8211; Assemblies in available in SQL Server. dm_db_file_space_usage &#8211; Database file usage to determine if databases are getting low on space and need immediate attention. dm_exec_cached_plans &#8211; Cached query plans available to SQL [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5%2F&#038;title=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-5%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-dmv-ssis-sql-azure-offline-database-day-5/" data-a2a-title="SQL Server Database Administrator Interview Questions and Answers (Day-5)"></a></p><p><strong>List out Dynamic Management Views (DMV&#8217;s) and the value that they provide to developers or DBAs.</strong></p>
<ul>
<li>dm_tran_locks &#8211; Locking and blocking.</li>
<li>dm_clr_loaded_assemblies &#8211; Assemblies in available in SQL Server.</li>
<li>dm_db_file_space_usage &#8211; Database file usage to determine if databases are getting low on space and need immediate attention.</li>
<li>dm_exec_cached_plans &#8211; Cached query plans available to SQL Server.</li>
<li>dm_exec_sessions &#8211; Sessions in SQL Server.</li>
<li>dm_exec_connections &#8211; Connections to SQL Server.</li>
<li>dm_db_index_usage_stats &#8211; Seeks, scans, lookups per index.</li>
<li>dm_io_virtual_file_stats &#8211; IO statistics for databases and log files.</li>
<li>dm_broker_connections &#8211; Service Broker connections to the network.</li>
<li>dm_os_memory_objects &#8211; SQL Server memory usage sys.dm_tran_active_transactions &#8211; Transaction state for an instance of SQL Server.</li>
</ul>
<p><strong>Please explain the relationship between logins and users in the system and user databases.</strong></p>
<blockquote><p>Logins &#8211; All logins reside in the master database</p>
<p>Users &#8211; All users reside in the master database, other system databases and in the user defined databases.</p></blockquote>
<p><strong>Briefly explain the purpose of SQL Server Integration Services (SSIS)?</strong></p>
<blockquote><p>SQL Server Integration Services (SSIS) is a platform for data integration and workflow applications. It was first introduced with SQL Server 2005 replacement for Data Transformation Service (DTS). You build extraction, transformation, and load (ETL) packages with SSIS that extract, transform, and load data. A package is an SSIS object that defines the data source, transformation, and data destination used to integrate data from diverse data sources.</p>
<p>SSIS supports a variety of formats that you can use as the data source when you import data. These formats include: Microsoft Excel, Flat files, OLE-DB data sources, XML data sources etc. SSIS also supports SQL Server and these formats as data destination formats.</p></blockquote>
<p><strong>You have a default instance for SQL Server 2012 running on one computer. You install SQL Server 2014 on a different computer. You want to migrate the user databases from SQL Server 2012 to SQL Server 2014. What should you do?</strong></p>
<blockquote><p>You should register the SQL Server 2012 instance in SQL Server 2014 Management Studio and use the Copy Database Wizard to migrate the database.</p></blockquote>
<p><strong>You are upgrading a default instance of SQL Server 2012 to SQL Server 2014. What will be used as the SQL Server service account?</strong></p>
<blockquote><p>The service account specified for the SQL Server 2012 instance will be used as the SQL Server 2014 service account.</p></blockquote>
<p><strong>If you encounter this kind of an error message, what you need to look into to solve this problem?</strong></p>
<p><strong>[Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL Server not found.</strong></p>
<blockquote><p>Check if MS SQL Server service is running on the computer you are trying to log into.</p>
<p>Check on Client Configuration utility. Client and Server have to in sync.</p></blockquote>
<p><strong>What kind of LAN types do you know?</strong></p>
<blockquote><p>Ethernet networks and token ring networks.</p></blockquote>
<p><strong>What is SQL Azure?</strong></p>
<blockquote><p>SQL Azure is a cloud based relational database as a Service offered by Microsoft. Conceptually it is SQL server in the cloud.</p></blockquote>
<p><strong>How can we migrate from SQL server to SQL Azure?</strong></p>
<blockquote><p>For Data Migration, we can use BCP or SSIS. And for schema Migration we can use Generate Script Wizard. Also, we could use a Tool called SQL Azure migration wizard available on codeplex.</p></blockquote>
<p><strong>What is the system function to get the current user’s user id?</strong></p>
<blockquote><p>USER_ID(). Also check out other system functions like USER_NAME(), SYSTEM_USER, SESSION_USER, CURRENT_USER, USER, SUSER_SID(), HOST_NAME().</p></blockquote>
<p><strong>What are the built-ins used for processing rows?</strong></p>
<ul>
<li>Get_group_row_count(function)</li>
<li>Get_group_selection_count(function)</li>
<li>Get_group_selection(function)</li>
<li>Reset_group_selection(procedure)</li>
<li>Set_group_selection(procedure)</li>
<li>Unset_group_selection(procedure)</li>
</ul>
<p><strong>How many files can a Database contain in SQL Server?</strong></p>
<blockquote><p>A Database can contain a maximum of 32,767 files.</p></blockquote>
<p><strong>How do I troubleshoot SQL Server connectivity issues?</strong></p>
<ul>
<li>Check your SQL Server Error log to make sure that it enables TCP/IP protocol and establish the listening on a specific TCP port.</li>
<li>Enable TCP/IP protocol if you could not find the message in the Error Log.</li>
<li>Check firewall if you cannot telnet to the specific TCP port.</li>
<li>Ensure that the TCP port on which SQL Server is listening has been put into the exceptions of your firewall.</li>
</ul>
<p><strong>What is the maximum limit of SQL Server instances for a standalone computer?</strong></p>
<blockquote><p>50 instances on a stand-alone server for all SQL Server editions. SQL Server supports 25 instances on a failover cluster.</p></blockquote>
<p><strong>Why did a T-SQL script fail to run a job when it could successfully run in SQL Server Management Studio ?</strong></p>
<blockquote><p>If the SQL Server Agent Service account is different from the login account and if it does not have enough permission to execute the query, the job will fail.</p>
<p>You can simply give the SQL Server Agent Service account permissions to execute the query, this is not the best way from a security perspective. For SQL Server Agent Service account, it is recommended to give it the least amount of privileges.</p></blockquote>
<p><strong>How can I degrade a SQL Server database from a higher version to a lower one?</strong></p>
<blockquote><p>Yes, degrading a SQL Server database is not supported, but you can use a flexible workaround to resolve this issue. You can use SQL Server Management Studio to first generate scripts for a lower ersion and then use Data Import/Export Wizard to transfer data.</p></blockquote>
<p><strong>What is the difference between dropping a database and taking a database offline?</strong></p>
<blockquote><p>Drop database deletes the database along with the physical files, it is not possible to bring back the database unless you have a backup of the database.</p>
<p>When you take a database offline, you the database is not available for users, it is not deleted physically, it can be brought back online.</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server Database Administrator Interview Questions and Answers (Day-4)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 12 Jul 2016 19:10:08 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[.NET CLR]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Assembly]]></category>
		<category><![CDATA[bound connection]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administrator]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[login & principal]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[single user mode]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[vss writer]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3330</guid>

					<description><![CDATA[What is Network Packet Size in SQL? NPS(Network Packet Size) is the size of the TDS (tabular data stream) packets used to communicate between your applications and your relational database engine and default packet size is 4 kilobytes and its manily depends on network packet size configuration option. How do I resolve ‘SQL Server Setup [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&amp;linkname=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4%2F&#038;title=SQL%20Server%20Database%20Administrator%20Interview%20Questions%20and%20Answers%20%28Day-4%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-administrator-interview-questions-and-answers-osql-single-user-mode-assembly-vss-writer-day-4/" data-a2a-title="SQL Server Database Administrator Interview Questions and Answers (Day-4)"></a></p><p><strong>What is Network Packet Size in SQL?</strong></p>
<blockquote><p>NPS(Network Packet Size) is the size of the TDS (tabular data stream) packets used to communicate between your applications and your relational database engine and default packet size is 4 kilobytes and its manily depends on network packet size configuration option.</p></blockquote>
<p><strong>How do I resolve ‘SQL Server Setup cannot valid the service accounts’ error message during the setup?</strong></p>
<blockquote><p>The error message typically happens when you use domain accounts as service account. If the Activity Directory Service (ADS) is not available currently, so the setup cannot valid the domain accounts you specify.</p></blockquote>
<p><strong>What is difference between OSQL and Query Analyzer ?</strong></p>
<blockquote><p>Both are the same but there is little difference OSQL is command line tool which is execute query and display the result same a query analyzer but query analyzer is graphical and OSQL.</p>
<p>OSQL have not ability like query analyzer to analyze queries and show static on speed of execution and other useful thing about OSQL is that its helps in scheduling.</p></blockquote>
<p><strong>How to restart SQL Server in single user mode? How to start SQL Server in minimal configuration mode?</strong></p>
<blockquote><p>SQL Server can be started from command line, using the SQLSERVR.EXE. This EXE has some very important parameters with which a DBA should be familiar with. -m is used for starting SQL is a command line tool. Server in single user mode and -f is used to start the SQL Server in minimal configuration mode.</p></blockquote>
<p><strong>What is the use of the Public database role in SQL Server?</strong></p>
<blockquote><p>Every database user belongs to the public database role. When a user has not been granted or denied specific permissions on a securable, the user inherits the permissions granted to public on that securable.</p></blockquote>
<p><strong>Explain Certificate based SQL Server Logins/Principals?</strong></p>
<blockquote><p>Server principals with names enclosed by double hash marks (##) are for internal system use only. The following principals are created from certificates when SQL Server is installed, and should not be deleted.</p>
<ul>
<li>##MS_SQLResourceSigningCertificate##</li>
<li>##MS_SQLReplicationSigningCertificate##</li>
<li>##MS_SQLAuthenticatorCertificate##</li>
<li>##MS_AgentSigningCertificate##</li>
<li>##MS_PolicyEventProcessingLogin##</li>
<li>##MS_PolicySigningCertificate##</li>
<li>##MS_PolicyTsqlExecutionLogin##</li>
</ul>
</blockquote>
<p><strong>What are steps to load a .NET code in SQL SERVER ?</strong></p>
<blockquote><p>Write the managed code and compile it to a DLL/Assembly.</p>
<p>After the DLL is compiled using the “CREATE ASSEMBLY” command you can load the assemby into SQL SERVER. Below is the create command which is loading “mycode.dll” into SQL SERVER using the “CREATE ASSEMBLY” command.</p>
<p>CREATE ASSEMBLY AssemblyName FROM ‘C:/MyAssmbly.dll’</p></blockquote>
<p><strong>How can we drop an assembly from SQL SERVER?</strong></p>
<blockquote><p>DROP ASSEMBLY AssemblyName</p></blockquote>
<p><strong>Are changes made to assembly updated automatically in database?</strong></p>
<blockquote><p>No: it will not synchronize the code automatically. For that you have to drop the assembly (Using DROP ASSEMBLY) and create (Using the CREATE ASSEMBLY again).</p></blockquote>
<p><strong>If I want to see which files are linked with which assemblies?</strong></p>
<blockquote><p>Use sys.Assemblies_files system tables have the track about which files are associated with what assemblies.</p></blockquote>
<p><strong>Does .NET CLR and SQL SERVER run in different process?</strong></p>
<blockquote><p>.NET CLR engine (hence all the .NET applications) and SQL SERVER run in the same process or address space. This “Same address space architecture” is implemeted so that there no speed issues. If the architecture was implemented the other way (i.e. SQL SERVER and .NET CLR engine running in different memory process area) there would have been reasonable speed issue.</p></blockquote>
<p><strong>What is SQL Server VSS Writer?</strong></p>
<blockquote><p>The SQL Writer Service provides added functionality for backup and restore of SQL Server through the Volume Shadow Copy Service framework. When running, Database Engine locks and has exclusive access to the data files.</p>
<p>When the SQL Writer Service is not running, backup programs running in Windows do not have access to the data files, and backups must be performed using SQL Server backup.</p>
<p>Use the SQL Writer Service to permit Windows backup programs to copy SQL Server data files while SQL Server is running. It must be running when the Volume Shadow Copy Service (VSS) application requests a backup or restore. To configure the service, use the Microsoft Windows Services applet. The SQL Writer Service installs on all operating systems.</p></blockquote>
<p><strong>What issues SQL Server Upgrade Advisor helps you to identify that might affect your upgrade to latest version of SQL Server?</strong></p>
<blockquote><p>SQL Server Upgrade Advisor can help identify key issues that might affect your upgrade, such as deprecated or discontinued features, breaking changes and behaviour changes.</p></blockquote>
<p><strong>What is the quickest way to identify the cause of SQL Server Installation failures?</strong></p>
<blockquote><p>You can do that by reviewing the summary log files and individual component log files. If you review the summary log file and find installation errors, you should review the specific log file for that component for more information.</p></blockquote>
<p><strong>Briefly explain the purpose of SQL Server Reporting Services (SSRS)</strong></p>
<blockquote><p>You create reports that include content from a variety of data sources, including relational databases and OLAP databases with SQL Server Reporting Services (SSRS). You can format the reports on-demand by using a variety of formats, including Microsoft Excel, HTML, and PDF.</p>
<p>You can generate ad hoc (on-the-fly) reports or schedule them for recurring distribution. The primary tools you use to create reports are Report Builder and SQL Server Data Tools (SSDT) – Report Designer.</p></blockquote>
<p><strong>What is the purpose of SQL Server Full-Text Search Service?</strong></p>
<blockquote><p>You can query for words and phrases in columns in the database with SQL Server Full-Text Search. You can search for multiple forms of a word. SQL Server Full-Text Search is implemented by the SQL Server Database Engine.</p></blockquote>
<p><strong>What is Bound Connection?</strong></p>
<blockquote><p>Bound connections allow two or more connections to share the same transaction and locks. Bound connections can work on the same data without lock conflicts.</p>
<p>Bound connections can be created from multiple connections within the same application, or from multiple applications with separate connections. Bound connections make coordinating actions across multiple connections easier.</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
