Академический Документы
Профессиональный Документы
Культура Документы
Laboratrios Extra
Hugo Torralbo
hugo@nervinformatica.com.br
Esta obra est licenciada sob a licena
Creative Commons Atribuio-SemDerivados 3.0 Brasil.
Para ver uma cpia desta licena, visite
http://creativecommons.org/licenses/by-nd/3.0/br/.
Windows Server
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
22
22
23
23
24
24
25
25
26
26
27
27
28
28
29
29
30
30
Prtica: Services
31
31
Prtica: Services
32
32
Prtica: Services
33
33
Prtica: CMD
34
34
Prtica: CMD
C:\Users\Administrator> cd ..
C:\Users> cd Adm<TAB>
C:\Users\Administrator> cd \
C:\> mkdir teste
C:\> dir
C:\> cd teste
C:\teste> notepad teste.txt
Escreva algo no arquivo e salve-o.
C:\teste> copy teste.txt teste02.txt
C:\teste> more teste02.txt
C:\teste> type teste02.txt
C:\teste> cd ..
C:\> dir
C:\> xcopy teste
C:\> dir
C:\> del teste.txt
C:\> help
35
35
Prtica: CMD
C:\Users\Administrator> NET STOP Spooler
C:\Users\Administrator> NET START Spooler
C:\Users\Administrator> HOSTNAME
C:\Users\Administrator> TASKLIST
C:\Users\Administrator> DISKPART
DISKPART> LIST
DISKPART> LIST DISK
DISKPART> EXIT
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
SQL Server
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
53
54
54
55
55
56
56
57
57
58
58
59
59
60
60
61
61
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
Prtica: Servios
71
71
Prtica: Conexo
Inicie o Microsoft SQL Server Management Studio (SSMS).
Efetue logon com SQL Server Authentication, e com o usurio sa.
O que deve ser colocado em Server Name?
Como voc pode se conectar no SQL Server do vizinho?
Clique em New Query.
Na tela que se abrir, digite sp_who, e depois pressione F5.
Inicie o CMD.
C:\Users\Administrator> sqlcmd -e
1> sp_who
2> go
Como voc pode se conectar no SQL Server com sa via sqlcmd?
Como voc pode se conectar no SQL Server do vizinho via sqlcmd?
C:\Users\Administrator> sqlcmd -?
72
72
Teoria: Arquitetura
73
73
74
74
75
75
76
76
77
77
78
78
79
79
80
80
81
81
82
82
83
83
84
84
85
85
86
86
87
87
88
88
Prtica: Segurana
User
Login
Roles
89
89
90
90
91
91
Teoria: Procedures
Criao
USE Nerv;
GO
CREATE PROCEDURE uspGetEmployeeName
@EmployeeID int
AS
SET NOCOUNT ON;
SELECT Name FROM Employee WHERE EmployeeID =
@EmployeeID;
GO
Execuo
USE Nerv;
EXECUTE uspGetEmployeeName @EmployeeID = 1
GO
92
92
Teoria: Functions
Criao
USE Nerv;
GO
CREATE FUNCTION NumberOfEmployees (@DeptID int)
RETURNS @TotalOfEmployees int
AS
BEGIN
DECLARE @TotalOfEmployees AS int ;
SELECT @TotalOfEmployees = SUM(EmployeeID)
FROM Employee
WHERE DeptID = @DeptID;
RETURN @TotalOfEmployees;
END;
GO
Execuo
93
93
Teoria: Triggers
Criao
USE Nerv;
CREATE TRIGGER Reminder
ON Dept
AFTER INSERT, UPDATE
AS RAISERROR ('Notify Manager', 16, 10);
GO
94
94
95
95
96
96
97
97
98
98
Prtica: Backup
Clique com o boto direito no banco de dados de testes, e execute um
backup.
Execute o backup tambm via linha de comando.
BACKUP DATABASE Nerv TO DISK = 'C:\temp\Nerv.BAK'
GO
BACKUP LOG Nerv TO DISK = 'C:\temp\Nerv.TRN'
GO
99
99
100 100
101 101
102 102
103 103
104 104
105 105