<?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>SQL Injection &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sql-injection/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>Sat, 20 Apr 2019 18:30:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: Find Stored Procedures which use Dynamic SQL and Temporary Table</title>
		<link>https://www.dbrnd.com/2019/04/sql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table/</link>
					<comments>https://www.dbrnd.com/2019/04/sql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 08 Apr 2019 18:30:46 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Data Security]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dynamic sql]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[SQL Query]]></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[Stored Procedure]]></category>
		<category><![CDATA[Temp Table]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4076</guid>

					<description><![CDATA[Whenever you are searching for SQL query optimization tips or prevent SQL injection tips, you can find few common suggestions like: Please do not use Dynamic SQL in your Stored Procedure. Please try to avoid the use of Temp Tables. I always tell to database developers, please try to avoid the use of Dynamic 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&amp;linkname=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&amp;linkname=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&amp;linkname=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&amp;linkname=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&amp;linkname=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&amp;linkname=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" 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%2F2019%2F04%2Fsql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table%2F&#038;title=SQL%20Server%3A%20Find%20Stored%20Procedures%20which%20use%20Dynamic%20SQL%20and%20Temporary%20Table" data-a2a-url="https://www.dbrnd.com/2019/04/sql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table/" data-a2a-title="SQL Server: Find Stored Procedures which use Dynamic SQL and Temporary Table"></a></p><p>Whenever you are searching for SQL query optimization tips or prevent SQL injection tips, you can find few common suggestions like: Please do not use Dynamic SQL in your Stored Procedure. Please try to avoid the use of Temp Tables.</p>
<blockquote><p>I always tell to database developers, please try to avoid the use of Dynamic SQL and Temp Table in your Stored Procedures.</p></blockquote>
<blockquote><p>A Temp Table requires additional CPU/IO which degrades the query performance. A Dynamic SQL is not safe against the SQL Injection and It also compiles data every time which requires more Memory. </p></blockquote>
<blockquote><p>Here, I am sharing one of the important scripts which gives you list of SQL Server Stored Procedures, which use the Dynamic SQL and Temp Table.<br />
You can easily get the list of Stored Procedures and can make plans of modifying it.</p></blockquote>
<blockquote><p>Prepared this script using sys.dm_exec_describe_first_result_set and sys.procedures where error number 4 = Dynamic SQL and error number 10 = Temporary Table.</p></blockquote>
<pre class="crayon-plain-tag">SELECT  
	SP_Name
	,error_message
	,error_type_desc 
FROM (SELECT schema_name(schema_id)+'.'+name SP_Name FROM sys.procedures) AS T
CROSS APPLY sys.dm_exec_describe_first_result_set (SP_Name, NULL, 0) 
WHERE error_type IN (4,10)</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/04/sql-server-find-stored-procedures-which-use-dynamic-sql-and-temporary-table/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Create Prepared Statement, to increase Session Performance</title>
		<link>https://www.dbrnd.com/2016/11/postgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection/</link>
					<comments>https://www.dbrnd.com/2016/11/postgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 27 Nov 2016 17:04:08 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Parameterized Statements]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[PREPARE]]></category>
		<category><![CDATA[Prepared Statements]]></category>
		<category><![CDATA[Session]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3933</guid>

					<description><![CDATA[The PostgreSQL Prepared Statement or Parameterized Statements are always good for specific purpose like: can create Prepared Statement for frequently executing query of a session, It also prevents from SQL Injections. Prepared Statements are faster for a particular session because It does not require parsing and compiling for each execution. It is only session specific [&#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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&amp;linkname=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" 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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&amp;linkname=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" 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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&amp;linkname=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" 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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&amp;linkname=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" 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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&amp;linkname=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" 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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&amp;linkname=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" 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%2F11%2Fpostgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection%2F&#038;title=PostgreSQL%3A%20Create%20Prepared%20Statement%2C%20to%20increase%20Session%20Performance" data-a2a-url="https://www.dbrnd.com/2016/11/postgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection/" data-a2a-title="PostgreSQL: Create Prepared Statement, to increase Session Performance"></a></p><p>The PostgreSQL Prepared Statement or Parameterized Statements are always good for specific purpose like: can create Prepared Statement for frequently executing query of a session, It also prevents from SQL Injections. </p>
<blockquote><p>Prepared Statements are faster for a particular session because It does not require parsing and compiling for each execution. It is only session specific and once a session kill, Prepared Statements automatically destroy. </p></blockquote>
<p>Here, You can access more on Prepared Statements. </p>
<blockquote class="wp-embedded-content" data-secret="XqVzPdXZbn"><p><a href="https://www.dbrnd.com/2015/08/prepared-or-parameterized-statements-in-database-system/">Prepared or Parameterized Statements in Database System</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/08/prepared-or-parameterized-statements-in-database-system/embed/#?secret=XqVzPdXZbn" data-secret="XqVzPdXZbn" width="600" height="338" title="&#8220;Prepared or Parameterized Statements in Database System&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Small demonstration of PostgreSQL Prepared Statement:</strong></p>
<p><strong>Create a table with sample records:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students 
(
	StudID INTEGER PRIMARY KEY
	,StudName CHARACTER VARYING
	,StudClass CHAR(1)	
);

INSERT INTO tbl_Students 
VALUES (1,'Anvesh','A')
,(2,'Neevan','B'),(3,'Jenny','C')
,(4,'Roy','C'),(5,'Martin','C');</pre> </p>
<p><strong>Create a Prepared Statement to SELECT Students data:</strong></p>
<pre class="crayon-plain-tag">PREPARE pre_GetStudents (INT) AS 
SELECT *FROM tbl_Students WHERE StudID = $1;</pre> </p>
<p><strong>Execute a Prepared Statement:</strong></p>
<pre class="crayon-plain-tag">EXECUTE pre_GetStudents(2);</pre> </p>
<p><strong>System view to check the Prepare statements of session:</strong></p>
<pre class="crayon-plain-tag">SELECT *FROM pg_prepared_statements;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/11/postgresql-create-prepared-statement-to-increase-session-performance-prevent-sql-injection/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<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-1)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1/</link>
					<comments>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 18 Jul 2016 19:28:52 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Data Masking]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Decryption]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[orphaned user]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[secure socket layer]]></category>
		<category><![CDATA[security]]></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=3364</guid>

					<description><![CDATA[What do you mean by Database Security? Database security refers to the collective measures used to protect and secure a database or database management software from illegitimate use and malicious threats and attacks. It is a broad term that includes a multitude of processes, tools and methodologies that ensure security within a database environment. 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-security-interview-questions-and-answers-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%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-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%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-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%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-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%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-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%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-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%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-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-1%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-1)"></a></p><p><strong>What do you mean by Database Security?</strong></p>
<blockquote><p>Database security refers to the collective measures used to protect and secure a database or database management software from illegitimate use and malicious threats and attacks. It is a broad term that includes a multitude of processes, tools and methodologies that ensure security within a database environment.</p></blockquote>
<p><strong>What is Data Masking?</strong></p>
<blockquote class="wp-embedded-content" data-secret="JnDNNa5P6s"><p><a href="https://www.dbrnd.com/2015/11/database-theory-what-is-a-data-masking-2/">Database Theory: What is a Data Masking ?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/database-theory-what-is-a-data-masking-2/embed/#?secret=JnDNNa5P6s" data-secret="JnDNNa5P6s" width="600" height="338" title="&#8220;Database Theory: What is a Data Masking ?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is Data Theft?</strong></p>
<blockquote><p>Data theft is the act of stealing computer-based information from an unknowing victim with the intent of compromising privacy or obtaining confidential information. Data theft is increasingly a problem for individual computer users, as well as big corporate firms.</p>
<p>Data must be stored and transmitted securely, so that information such as credit card numbers cannot be stolen. Over the Internet and Wide Area Network (WAN) environments, both public carriers and private network owners often route portions of their network through insecure landlines, extremely vulnerable microwave and satellite links, or a number of servers.</p></blockquote>
<p><strong>What are the different types of Security levels?</strong></p>
<ul>
<li>Physical</li>
<li>Human</li>
<li>Operating System</li>
<li>Network</li>
<li>Database System</li>
</ul>
<p><strong>What does Database Encryption and Decryption mean?</strong></p>
<blockquote><p>Database encryption is the process of converting data, within a database, in plain text format into a meaningless cipher text by means of a suitable algorithm.</p>
<p>Database decryption is converting the meaningless cipher text into the original information using keys generated by the encryption algorithms.</p>
<p>Database encryption can be provided at the file or column level.</p></blockquote>
<p><strong>What is SQL injection?</strong></p>
<blockquote><p>SQL injection is an attack by malicious users in which malicious code can be inserted into strings that can be passed to an instance of SQL server for parsing and execution. All statements have to checked for vulnerabilities as it executes all syntactically valid queries that it receives.</p>
<p>Even parameters can be manipulated by the skilled and experienced attackers.</p></blockquote>
<p><strong>What are the methods used to protect against SQL injection attack?</strong></p>
<p>Following are the methods used to protect against SQL injection attack:</p>
<ul>
<li>Use Parameters for Stored Procedures</li>
<li>Filtering input parameters</li>
<li>Use Parameter collection with Dynamic SQL</li>
<li>In like clause, user escape characters</li>
</ul>
<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.</p>
<p>To do this launch SQL Server Configuration Manager and do the following:</p>
<p>select the instance of SQL Server, right click and select Properties. After selecting properties you will just set Hide Instance to &#8220;Yes&#8221; and click OK or Apply.</p>
<p>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>What are Orphaned Users?</strong></p>
<p>A database user for which the corresponding SQL Server login is undefined or is incorrectly defined on a server instance cannot log in to the instance. Such a user is said to be an orphaned user of the database on that server instance.</p>
<ul>
<li>A database user can become orphaned if the corresponding SQL Server login is dropped.</li>
<li>A database user can become orphaned after a database is restored or attached to a different instance of SQL Server.</li>
<li>Orphaning can happen if the database user is mapped to a SID that is not present in the new server instance.</li>
</ul>
<p><strong>Would you please describe any five server role with its permission?</strong></p>
<ul>
<li>bulkadmin: Granted &#8211; ADMINISTER BULK OPERATIONS</li>
<li>dbcreator: Granted &#8211; CREATE ANY DATABASE</li>
<li>diskadmin: Granted &#8211; ALTER RESOURCES</li>
<li>processadmin: Granted &#8211; ALTER ANY CONNECTION, ALTER SERVER STATE</li>
<li>securityadmin: Granted &#8211; ALTER ANY LOGIN</li>
<li>serveradmin: Granted &#8211; ALTER ANY ENDPOINT, ALTER RESOURCES, ALTER SERVER STATE, ALTER SETTINGS, SHUTDOWN, VIEW SERVER STATE</li>
<li>setupadmin: Granted &#8211; ALTER ANY LINKED SERVER</li>
<li>sysadmin: Granted with GRANT option &#8211; CONTROL SERVER</li>
</ul>
<p><strong>Which authentication mode is more secured?</strong></p>
<blockquote><p>Windows authentication is definitely more secure as it’s controlled and authenticated by Active Directory policies.</p></blockquote>
<p><strong>What is a Symmetric key in Data encryption process?</strong></p>
<blockquote><p>In Symmetric cryptography system, the sender and the receiver of a message share a single, common key that is used to encrypt and decrypt the message. This is relatively easy to implement, and both the sender and the receiver can encrypt or decrypt the messages.</p></blockquote>
<p><strong>What is a Asymmetric key in Data encryption process?</strong></p>
<blockquote><p>Asymmetric cryptography, also known as Public-key cryptography, is a system in which the sender and the receiver of a message have a pair of cryptographic keys – a public key and a private key – to encrypt and decrypt the message. This is a relatively complex system where the sender can use his key to encrypt the message but he cannot decrypt it. The receiver, on the other hand, can use his key to decrypt the message but he cannot encrypt it.</p></blockquote>
<p><strong>What Secure Socket Layer (SSL) with SQL Server and can we enable it?</strong></p>
<blockquote><p>Yes: We can enable SSL with SQL Server</p>
<p>Microsoft SQL Server can use Secure Sockets Layer (SSL) to encrypt data that is transmitted across a network between an instance of SQL Server and a client application. Enabling SSL encryption increases the security of data transmitted across networks between instances of SQL Server and applications.</p></blockquote>
<p><strong>What are basic steps to configure SSL for SQL Server?</strong></p>
<blockquote><p>Install a certificate in the Windows certificate store of the server computer.</p>
<p>Click Start, in the Microsoft SQL Server program group, point to Configuration Tools, and thenclick SQL Server Configuration Manager.</p>
<p>Expand SQL Server Network Configuration, right-click the protocols for the server you want, and then click Properties.</p>
<p>On the Certificate tab, configure the Database Engine to use the certificate.</p>
<p>On the Flags tab, view or specify the protocol encryption option. The login packet will always be encrypted.</p></blockquote>
<p><strong>What are the built-In Schemas?</strong></p>
<ul>
<li>dbo</li>
<li>guest</li>
<li>sys</li>
<li>INFORMATION_SCHEMA</li>
</ul>
<p><strong>Are you agree with User-Schema Separation in SQL Server?</strong></p>
<blockquote><p>Yes: User-schema separation allows for more flexibility in managing database object permissions. A schema is a named container for database objects, which allows you to group objects into separate namespaces.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-data-mask-encryption-decrption-ssl-orphand-user-sql-injection-day-1/feed/</wfw:commentRss>
			<slash:comments>1</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>
	</channel>
</rss>
