Download Projects: 1. You have given a brand new system. We need to install

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

SQL wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Database wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Projects:
1. You have given a brand new system. We need to install SQL Server 2008 R2. What will be your
approach?
>> Docs according to company requirements and doc should include
>> Install SQL Server 2008 R2 on DGDC (Dev), ZAAR (Test), VM-Cafe(Prod), HQR (Prod) and DG_Lion
(Application Server). Please install as a named instance.
Example:
Instance Name: Eagle_Dev, Eagle_prod, Eagle_Test
DB Name: MCAP_Eagle
Data Modeling:
1. Create database in your own dev and test instances and create all the tables
2. Write a T-SQL script to insert 10000 records for each table in the development databases.
3. Write script to denormalize a normalized table. Also use SSMS
4. Write a script to normalize a flat table. Also use SSMS
1. Setup Backup jobs for system databases and user databases. Make sure you take network backup.
Make sure your retention policy is 1 for a period of 7 days for you dev databases. All older backups
should be deleted automatically.
2. Take on demand backup for user databases on dev databases and restore it on ZAAR server.
3. Setup maintenance plan for indexes.
4. Move one of the development database to test server
5. Move a database using script. You need to include all data as well.
6. What is the difference between copy only backup and regular/scheduled backups?
Interview Question:
1. Have you done data modeling? What tools have you used? How many projects have you worked? Tell
me your experience in Data Modeling
>> I have been working as a DBA for 6 years. During this period, I have worked on 7 different big data
modeling projects. I am really prod for 2 of the projects where I was team lead.
Third tools (Toad Data Modeler, ERWIN)
>> **** + Steps (2nd step: Normalization),
Backup:
Q1. What is your backup strategy? What is your backup plan?
>>
>> Jobs also setup in way to delete older backups and clean-up old history.
Q2. Recently one of my DBA at my work informed that on development database (dg_lab) he
executed a DELETE query but forgot to place WHERE clause and committed the transaction. How do
you recover the database?
>> Since the transaction is committed, it cannot be rolled back. We have to restore ........... the latest full
backup.
BEGIN TRAN
Delete from customer
ROLLBACK
--- COMMIT;
GO
END TRAN
Q4. What are 2 options to validate whether or not a backup will restore successfully? How do you
validate your backup?
Q5. Explain different types of BACKUPs available in SQL Server? What kind of backup you do and why?
>> Use Backup Strategy
Q6. What are the different ways of moving data/databases between servers and databases in SQL
Server? How do you deploy a database?
Q9. What are the operations you can not perform while backup of a database in progress?
What are the reasons every time I start a job, it fails?
Q10. What is the difference between full, differential, and transaction log backup/What are
the different ways to backup a database?
1. Do you delete a database backup manually or automatically? Please explain
2. How do you manage your backup files in your company?
>> Retention Policy
3. How long and why do you keep your backups (Full/Diff/Tran) for the specified period?
USE DG_LabTest
GO
DECLARE @Part_Id INT
DECLARE @Category_Id INT
DECLARE @Desc VARCHAR (50)
CREATE TABLE Part (Part_Id INT, Category_Id INT, Description VARCHAR
(50))
SET @Part_Id = 0
SET @Category_Id = 0
WHILE @Part_Id < 2 --Try this(9999)
BEGIN
SET @Part_Id = @Part_Id + 1
WHILE @Category_Id < 3 --Try this(10000)
BEGIN
SET @Category_Id = @Category_Id + 1
SET @Desc = 'Part_Id ' + CAST (@Part_Id as CHAR (1)) +
' for Category_Id ' + CAST(@Category_Id as CHAR (1))
INSERT into PART VALUES (@Part_Id, @Category_Id, @Desc)
END
SET @Category_Id = 0
END
-- SELECT * from PART
-- DROP table PART
Output:
Part_Id
Category_Id Description
----------- ----------- ----------------------------------------1
1
Part_Id 1 for Category_Id 1
1
2
Part_Id 1 for Category_Id 2
1
3
Part_Id 1 for Category_Id 3
2
1
Part_Id 2 for Category_Id 1
2
2
Part_Id 2 for Category_Id 2
2
3
Part_Id 2 for Category_Id 3
Explanation: First WHILE LOOP sets/increments the Part_Id, and second WHILE loop sets/increments
the Category_Id to a different value each time through the loop. The code inside the first WHILE loop
was executed only 2 times and the code inside the second WHILE loop was executed 6 times. So, this
produces total of 6 records.
========================================
/*
File:
Purpose:
Developed By:
Date Wrote:
*/
USE DG_LabTest
GO
-- Create variables
DECLARE @Part_Id INT
DECLARE @Category_Id INT
DECLARE @Desc VARCHAR (150)
-- Create Table
CREATE TABLE Part_Test (Part_Id INT, Category_Id INT, Description VARCHAR
(150))
/*
CREATE TABLE Patient (
Patient_ID INT,
SSN varchar (11),
Patient_Desc varchar (200)
)
*/
SET @Part_Id = 0
SET @Category_Id = 0
WHILE @Part_Id < 2 -- 0 It should be TRUE
BEGIN
SET @Part_Id = @Part_Id + 1 -- 1
WHILE @Category_Id < 3 -- 0
BEGIN
SET @Category_Id = @Category_Id + 1 -- 1
SET @Desc =
'Part_Id: ' +
CAST (@Part_Id AS VARCHAR (10) )+
' for Category_Id: ' +
CAST(@Category_Id as CHAR (1))
INSERT into Part_Test VALUES (@Part_Id, @Category_Id,
@Desc)
END
SET @Category_Id = 0
END
-- DROP table PART
SELECT Category_Id, Description
INTO PART_2
from PART_TEST
select * from PART_2
select
PART_1.Part_Id,
PART_2.Category_Id, PART_2.Description
INTO Part_Combo
From dbo.PART_1 INNER JOIN PART_2
ON PART_1.Part_ID = PART_2.Category_Id
select * from Part_Combo
select
Category_Id, Description
From dbo.PART_2