WIN 10 i štampač

Šta ako vam se u print queue vašeg štampača “zaglavi” dokument, i ne možete ga obrisati na klasičan način?
Pa problem se uglavnom rešava tako što se pod “Services” restartuje (ili stop pa start) “Print Spool”.
Ako ovo ne reši problem, zaustaviti “Print Spool”, i iz foldera C:\Windows\system32\spool\PRINTERS izbrisati sve postojeće fajlove. Onda ponovo startovati servis “Print Spool”. To bi trebalo da reši problem.

Link.

SQL deadlocks

Više o “mrtvom zaključavanju” 🙂 u mom ranijem postu.
A ovde više o logovima istog.
Dakle da bi se uopšte u SQL logu upisalo nešto o deadlocks, moraju se uraditi neke stvari :
1. Enable tracing
Trace flags are switches that adminstrators or developers can use to change the behavior of SQL Server.
1a. Uključiti da izlaz komande bude prikazan u MS SQL SMS (inače ide u SQL error log po default-u) :
DBCC TRACEON (3604) — turns on flag 3604 for your session
DBCC PAGE (master, 1, 1, 0);
DBCC TRACEOFF(3604) — turns off 3604 for your session
Obavezno kad se sve završi, isključiti opciju :
DBCC TRACEOFF(3604) — turns off 3604 for your session
(link)
1b. Videti šta je sve uključeno od trace flags (link) :
dbcc tracestatus();
go
Dobija se ovo :

Napomena :
Trace flag 3604 – Trace flag 3604 sends trace output to the client. This trace flag is used only when setting trace flags with DBCC TRACEON and DBCC TRACEOFF.
Trace flag 3605 – Sends trace output to the error log.
1c. Odabrati trace flag koji nam treba (spisak trace flag-ova).
Za praćenje deadlocks trebaju nam trace flags 1204 i 1222 (1204 lists the information by node; 1222 lists it by process and resource) :
DBCC TRACEON (1204, 1222)
Kad izlistamo sada sve trace flags :

Ako se uključi da bude globalno (bolje) onda se hvata sve, a ne samo otvorena sesija :
DBCC TRACEON (1204, 1222, -1)

*****
DBCC – DataBase console command
Trace flag 1204 – starija varijanta
Trace flag 1222 – od SQL 2005, lakše čitljivi logovi

SQL running port on WIN 2012 R2

Kako naći port na kome “trči” sql server na nekom serveru.

Opcija 1
Ako imate RD pristup serveru :
1. Otvoriti Task Manager
2. Otići na tab “Details”
3. Naći PID pod kojim “trči” sqlsrv.exe (npr 4604)
4. Otvoriti CLI i ukucati : netstat -ano :
C:\Users\velda>netstat -ano
Active Connections
…..
Proto Local Address Foreign Address State PID
TCP 10.10.10.93:1433 10.10.10.8:63740 ESTABLISHED 4604
TCP 10.10.10.93:1433 10.10.10.8:50932 ESTABLISHED 4604
TCP 10.10.10.93:1433 10.10.10.8:50933 ESTABLISHED 4604
…..
Vidimo da je port : 1433

Opcija 2
CLI kao Administrator na serveru :
C:\Windows\system32>netstat -abn
Active Connections
Proto Local Address Foreign Address State
…..
TCP 10.10.10.93:1433 10.10.10.8:63740 ESTABLISHED
[sqlservr.exe]
TCP 10.10.10.93:1433 10.10.10.8:50932 ESTABLISHED
[sqlservr.exe]
TCP 10.10.10.93:1433 10.10.10.8:50933 ESTABLISHED
[sqlservr.exe]
…..

Opcija 3
Sa korisničke mašine iz CLI probati konekciju :
telnet
Odnosno u našem primeru :
telnet 10.10.10.93 1433
Tu se onda dobije blanko ekran unutar CLI. To znači da veza postoji, i da server sluša na portu TCP 1433

Oracle baza i Oracle Enterprise Manager Database Express 12c

Oracle Enterprise Manager Database Express 12c služi za praćenje stanja u bazi, kao i praćenje raznih SQL komandi nad samom bazom.
Kada se gledaju SQL akcije nad bazom (pod stavkom “Performance Hub/Monitored SQL”), one su u ovakvoj tabeli :

Evo objašnjenja pojedinačnih polja :
Status – Upit je završen, upit je u toku (vrti se krugić), upit završen greškom (crveni krstić)
Duration – vreme koje protekne za korisnika dok on ne dobije rezultat upita (znači najvažniji parametar :-))
Type – SQL, PL/SQL, DBOP (DataBase operation)
ID – unique identifier for the SQL statement
SQL Plan Hash
User – ko je pokrenuo SQL komandu
Parallel – (DOP : degree of parallelism), parallel execution uses multiple processes to
accomplish a single task by splitting a task into smaller sub tasks (link)
Database Time – DB time is total time spent by user processes either actively working or actively waiting in a database call :
DB Time = CPU time + I/O time + Non-idle wait time
I/O requests – mere se po sekundi
Start – kad je startovana SQL komanda
Ended – kad se završila SQL komanda (prazno, ako se komanda još uvek izvršava)
SQL Text – sama SQL komanda
*****
SQL statements are monitored only if they have consumed at least 5 seconds of CPU or I/O time.
Most systems are performing satisfactorily if latency is fewer than 10 milliseconds.
*****
Dobar link.
Odličan PDF dokument.

PowerShell zgodne komande

1. Kako videti kada je sve server/radna stanica restartovan :
PS C:\Users\veldaebel> Get-EventLog System | Where-Object {$_.EventID -eq “1074” -or $_.EventID -eq “6008” -or $_.EventID -eq “1076”} | ft Machinename, TimeWritten, UserName, EventID, Message -AutoSize -Wrap
MachineName TimeWritten UserName EventID Message
———– ———– ——– ——- ——-
VELDA123 05.12.2018 12:44:00 PM 6008 The previous system shutdown at 12:13:42 PM on ‎12/‎5/‎2018 was unexpected.
…..
2.

Oracle i tnsping

Tnsping je jako zgodna komanda (koristi se iz CLI) za određivanje brzine reakcije Oracle baze.
Ne postoji poseban paket za tu komandu, već ona dolazi u okviru instalacije Oracle client-a (u mom slučaju 12.1), ali OBAVEZNO instalirati tzv “Runntime” klijent, da bi i komanda bila uključena.

Šta sve treba uraditi da bi se koristila komanda tnsping
Prvo : WIN PATH promenljiva
Da bi se koristila bilo odakle, treba njenu lokaciju dodati u PATH promenjivu na WIN 10 (kod mene) klijentskoj mašini : link ka mom postu
Putanja ka tnsping komandi je (kod mene) : C:\app\client\velda\product\12.1.0\client_1\BIN
Paziti, ova promena PATH varijable postaje aktivna tek kada se CLI zatvori i otvori ponovo…..
PATH promenljiva se jako jednostavno proverava iz CLI-ja :

Dobar link kako se komanda koristi.
Drugo : nalaženje podatka za net_service_name
Kako odrediti net_service_name (tnsname) za Oracle bazu
Kratak uvod :
The CONNECT_DATA section contains the following :
SID parameter, which identifies the SID of the Oracle database. The SID is sales.
SERVICE_NAME parameter, which identifies the service. The destination service name is a database service named sales.us.example.com.
Recommendation is SID=service name.
Sve podatke o njoj imate ako imate formiranu konekciju kroz SQL Developer 🙂
Treće : populacija tnsnames.ora fajla
Takođe pre korišćenja tnsping komande podatke o konekciji ka bazi treba uneti u tnsnames.ora fajl na klijentskoj mašini (kod mene je taj fajl ovde : C:\app\client\veldaebel\product\12.1.0\client_1\network\admin\).
Napomena : ime koje u tnsnames.ora date konekciji se onda koristi u komandi tnsping (u donjem primeru to je “oracle2″/velika i mala slova nisu bitna).
Primer unosa u tnsnames.ora fajlu :
ORACLE2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.33.100.55)(PORT = 1528))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Četvrto : primena komande
C:\Users\veldaebel>tnsping oracle2 5
TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2018 09:08:29
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\app\client\veldaebel\product\12.1.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.33.100.55)(PORT = 1528)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)
OK (20 msec)
OK (10 msec)
OK (0 msec)
OK (20 msec)

MS SQL SMS Activity Monitor

MS SQL SMS – Microsoft SQL Server management Studio
U njemu je jako zgodan “Acitivity Monitor” koji daje pregled toga ko šta radi nad odabranom bazom.
Otvaranje Activity Monitor-a :
1. Kroz ikonicu :
2. Desni klik na ime SQL servera za koji ste zakačeni :
Ali treba znati šta koja kolona znači, i šta znači ono što piše u njoj.

Objašnjenja :
Session ID – A unique number that is assigned to each user connection when the connection is made.
User Process – Displays 0 for a system process and 1 for a user process. By default, the filter setting for this column is 1. This displays only user processes.
Login – The SQL Server login name under which the session is currently executing.
Database – The name of the database that is included in the connection properties of processes that are currently running.
Task State – The state of the task.
Background-The SPID is running a background task, such as deadlock detection.
Sleeping-The SPID is not currently executing. This usually indicates that the SPID is awaiting a command from the application.
Running-The SPID is currently running on a scheduler.
Runnable-The SPID is in the runnable queue of a scheduler and waiting to get scheduler time.
Sos_scheduler_yield-The SPID was running, but it has voluntarily yielded its time slice on the scheduler to allow another SPID to acquire scheduler time.
Suspended-The SPID is waiting for an event, such as a lock or a latch.
Rollback-The SPID is in rollback of a transaction.
Defwakeup-Indicates that the SPID is waiting for a resource that is in the process of being freed. The waitresource field should indicate the resource in question.
Command – The kind of command that is being processed under the task.
Application – The name of the application program that created the connection.
Wait Time (ms) – The time, in milliseconds, in which this task is waiting for a resource. When the task is not waiting, the wait time is 0.
Wait Type – The name of the last or current wait type.
Pageiolatch_sh-the latch request is in shared mode
IO_COMPLETION-is waiting for IO to complete
Wait Resource – The name of the resource that is needed.
Blocked By – If there are blocking sessions, the ID of the session that is blocking the task.
Head Blocker – If there are blocking sessions, identifies the session that causes the first blocking condition. A value of 1 represents a head blocker for other sessions.
Memory Use (KB) – The amount of memory, in kilobytes, that is being used by the task.
Host Name – The name of the computer that made the connection to the instance of SQL Server.
Workload Group – The name of the Resource Governor workload group for the session.

Dobar link.