SQL upit ka nekom drugom serveru

Kako da, konektovani na jedan server, postavite upit ka nekom drugom serveru?
Iz MSSQLSMS-a postoje dva načina :
1) Serveri su linkovani
sql-upit3
2) Pod MSSQLSMS-om su svi željeni server definisani, u okviru jedne grupe
a) Prvo napraviti grupu :
sql-upit4
b) Registrovati server :
sql-upit7
c) Prebaciti željene servere u novoformiranu grupu :
sql-upit5
d) Izvršiti upit nad celom grupom servera :
sql-upit6

Posted in Windows | Tagged , , | Leave a comment

SQL upit – ime kompjutera

1) Kako kroz SQL upit dobiti ime kompjutera :
select ServerProperty(‘ComputerNamePhysicalNetBIOS’);

2) I plus dodatne podatke o SQL-u na toj mašini :
select ServerProperty(‘ComputerNamePhysicalNetBIOS’),ServerProperty(‘Edition’);

3) Verzija proizvoda :
select ServerProperty(‘ComputerNamePhysicalNetBIOS’),ServerProperty(‘MachineName’),ServerProperty(‘Edition’),ServerProperty(‘ProductLevel’);
Napomena : prve dve stavke uglavnom daju isti izlaz, pa ja preferiram “MachineName”.
ProductLevel returns Level of the version of SQL Server instance :
‘RTM’ = Original release version
‘SPn’ = Service pack version
‘CTP’, = Community Technology Preview version

4) I na kraju, da bi podaci u kolonama imali lepo svoja imena :
select ServerProperty(‘MachineName’) AS ‘Machine Name’,
ServerProperty(‘Edition’) AS ‘Product Edition’,
ServerProperty(‘ProductVersion’) AS ‘Product Version’,
ServerProperty(‘ProductLevel’) AS ‘Product Level’;

Dobar link sa listom nekih osnovnih veličina dobijenih iz ServerProperty-ja.
Link sa kompletnom listom stavki koje se mogu dobiti iz ServerProperty-ja.

5) I kada skupim sve podatke o SQL-u i o server :
select
cpu_count,
hyperthread_ratio,
[physical_memory_in_bytes]/1024/1024 AS [physical memory MB],
[virtual_memory_in_bytes]/1024/1024 AS [virtyal memory MB],
[bpool_committed]*8/1024 AS [bpool commited MB],
[bpool_commit_target]*8/1024 AS [bpool commited target MB],
ServerProperty(‘MachineName’) AS ‘Machine Name’,
ServerProperty(‘Edition’) AS ‘Product Edition’,
ServerProperty(‘ProductVersion’) AS ‘Product Version’,
ServerProperty(‘ProductLevel’) AS ‘Product Level’
from sys.dm_os_sys_info;

Posted in Windows | Tagged , , , | Leave a comment

SQL upit o CPU/RAM koje baza koristi

Upit koji se koristi zavisi od verzije SQL servera koji se pita.
Upit UVEK treba da se radi nad “master” bazom, da bi se dobili podaci za ceo server :
sql-cpu1
sql-cpu2
U zavisnosti od toga koja je verzija SQL servera u pitanju, dobiće se različiti podaci iz sys.dm_os_sys_info (link) :
SQL 2005 :
2289_columns_2005
SQL 2008 (link) :
2289_columns_2008
Značenje pojedinih stavki može se naći ovde.
Neke meni važnije vrednosti su :
cpu_count – Specifies the number of logical CPUs on the system.
hyperthread_ratio – Specifies the ratio of the number of logical or physical cores that are exposed by one physical processor package.
physical_memory_in_bytes – Specifies the total amount of physical memory on the machine.
virtual_memory_in_bytes – Specifies the total amount of virtual address space available to the process in user mode.
bpool_commited – Represents the committed memory in the memory manager. Does not include reserved memory in the memory manager.
bpool_commit_target – Represents the amount of memory, that can be consumed by SQL Server memory manager.

a) Generalni upit koji daje sve podatke iz date sys.dm_os_sys_info tabele (za server SQL 2008) :
select * from sys.dm_os_sys_info;
b) I kako moj upit na kraju izgleda :
select
cpu_count,
hyperthread_ratio,
physical_memory_in_bytes,
virtual_memory_in_bytes,
bpool_committed,
bpool_commit_target
from sys.dm_os_sys_info;
c) A pošto je nezgodno čitati podatke u bajtovima :
select
cpu_count,
hyperthread_ratio,
[physical_memory_in_bytes]/1024/1024 AS [physical memory MB],
[virtual_memory_in_bytes]/1024/1024 AS [virtyal memory MB],
[bpool_committed]*8/1024 AS [bpool commited MB],
[bpool_commit_target]*8/1024 AS [bpool commited target MB]
from sys.dm_os_sys_info;

SQL 2012 (link) :
Column Name in 2008 -> Column Name in 2012
physical_memory_in_bytes -> physical_memory_kb
bpool_commit_target -> committed_target_kb
bpool_visible -> visible_target_kb
virtual_memory_in_bytes -> virtual_memory_kb
bpool_commited -> committed_kb

d) Kako dobiti odjednom sve podatke o verziji i sličnim podacima :
select @@version;
Važi za (bar koliko sam videla) sve verzije SQL servera.

Posted in Windows | Tagged , , | Leave a comment

Heklanje 55 : traka za uši

Bilo mi je malo dosadno, a imala sam pri ruci sive vunice, i ispade simpatična traka za uši.
Isprobano udobna i topla 🙂
siva-traka
A evo i šema heklanja :
sema-heklanja-traka-za-glavu1

Posted in Odmor | Tagged , , | Leave a comment

WIN server 2008 i “Disc Cleanup” opcija koje tu nema

Na WIN server 2008 I 2008 R2 ne postoji opcija za “Disc Cleanup”.
Da bi se ta opcija aktivirala može se uraditi sledeće :
1. Aktivirati opcija “Desktop Experience” (link), što zahteva restart server pre nego što postane aktivna
ILI
2. Prebacivanje dva već postojeća fajla sa tačke A na tačku B (link) :
Windows Server 2008 R2 – 64-bit – C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe
Windows Server 2008 R2 64-bit C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui
Windows Server 2008 – 64-bit – C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui
Windows Server 2008 – 64-bit – C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe.mui
Windows Server 2008 – 32-bit – C:\Windows\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui
Windows Server 2008 – 32-bit – C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe
*****
Once you’ve located the files move them to the following locations:
Cleanmgr.exe should go in %systemroot%\System32.
Cleanmgr.exe.mui should go in %systemroot%\System32\en-US.
*****
Napomena : %systemroot% je obično u c:/windows/
*****
You can now launch the Disk cleanup tool by running Cleanmgr.exe from the command prompt, or by clicking Start and typing Cleanmgr into the Search bar.

Posted in Windows | Tagged , | Leave a comment

Web browser i neželjeni dodatak “startfenster.de” (browser hijacker)

Moji početni uslovi : WIN 7, IE 11, Chrome 54.0
Ako ste zapatili neželjeni dodatak na svom web brower-u tipa : ” http://www.startfenster.de/suche/ as the homepage”, evo šta uraditi :
WIN OS
Iz “Control Panel-a” uninstall “Startfenster.de” program, kao i bilo šta drugo od programa što deluje sumnjivo (može da se maskira kao VLC-Updater (morala sam ručno da ga obrišem!), stvari instalirane u novije vreme npr).
Proći celu mašinu sa nekoliko raznih antivirus/addware/malware softvera, za svaki slučaj. Ja sam koristila :
–+Symantec – sem nekog cookie nije našao ništa
+++AdwCleaner (link) – našao i skinuo moj malware, ali je specifično samo za taj, tako da drugo nije našao
–+PlumBytes Anti-malware (link koji je našao još gomilu gadosti, ali se na žalost plaća.)
SpyHunter (link) – nije hteo da se instalira
–+Malwarebytes (link) – obavezno ga pokrenuti sa administratorskim nalogom i podesiti proxy (ako postoji), i kada se startuje scan, “Check for updates” traje duuuugo, tako da treba biti strpljiv. Našao je problem, ali duplo manje nego PlumBytes, i puna verzija se plaća 🙁 . Pored toga nije hteo da obriše nađeno, dok se ne plati.
Ad-Aware (link) – probala sam (naravno) free verziju, ali neće da se instalira
+++EmsisoftAntiMalware (link) – može da se testira za DŽ 30 dana, mora da se podesi proxy pre update-a definicija. Detektovao je backdoor koji ni jedan drugi AV nije.
+++HerdProtect (link) – free je i u Cloud-u, tako da je vrlo portabilan, skenira duuuugoooooo. Ali je našao nekoliko PUP-ova, kao i još zaostalo parče startfenster-a!!!
-++IObit Malware Fighter (link) – pokušaće da uvali i neki DashLane SW za lozinke, pa treba paziti ;-), ima free i Pro verziju (BitDefender ide samo uz Pro verziju). Jako dugo skenira (tj mnogo mu treba), ostavila sam ga da radi preko noći, i našao je još dva trojanca.

Tek kada prođete sa SVIM ovim kroz svoj računar, videćete šta ste sve zapatili 🙂
Posle čišćenja moraće da se restartuje računar.

Kako “počistiti” browser-e :
IE 11
1. Ući u “Internet options”
2. Ići na opciju/tab “Options”
3. Kliknuti na stavku “Manage Add-ons”
4. Staviti željenog provajdera kao default.
Ako vašeg željenog provajdera nema na listi, otići na link i dodati ga.
5. Obrisati SVE iz broser history/cache/cookies/itd.
Link1 i link2 po kijim sam uputstvima ja radila.
Google Chrome
Ukloniti neželjene pretraživače sa spiska pretraživača.
Obrisati SVE iz broser history/cache/cookies/itd.
Kao početnu stranu browser-a staviti about:blank.
FireFox
Ukloniti neželjene add-ons

Dobar link o samom startfenster-u. Ali nemojte koristiti YAC za uklanjanje istog, jer nije baš na dobrom glasu (link).
Još dobrih sajtova : link1 i link2.

Skraćenice :
PUP – potentially unwanted program

Posted in Windows | Tagged , | Leave a comment

SQL upiti

Počinjem sada malo ovime da se bavim.
Do sada sam radila samo neke male upite nad MySQL bazicama.
Dobar link za početnike (tj takve kao što sam ja).
*****
Par opštih stvari vezanih za SQL :
SQL stands for Structured Query Language
SQL lets you access and manipulate databases
SQL is an ANSI (American National Standards Institute) standard
SQL keywords are NOT case sensitive
*****
Some of The Most Important SQL Commands :
SELECT – extracts data from a database
UPDATE – updates data in a database
DELETE – deletes data from a database
INSERT INTO – inserts new data into a database
CREATE DATABASE – creates a new database
ALTER DATABASE – modifies a database
CREATE TABLE – creates a new table
ALTER TABLE – modifies a table
DROP TABLE – deletes a table
CREATE INDEX – creates an index (search key)
DROP INDEX – deletes an index
*****
Uobičajena forma SQL upita :
SELECT column_name1,column_name2 FROM table_name;
SELECT DISTINCT column_name,column_name FROM table_name;
U ovom slučaju se traže sve JEDINSTVENE kombinacije OBE kolone, I to se prikazuje.
SELECT column_name,column_name FROM table_name WHERE column_name operator value;
Pri čemu se “WHERE” klauzula može odnositi na bilo koju vrednost iz navedenih kolona, npr :
select distinct Ime,Prezime,ImeOca from dbo.ZAPOSLENI where Ime=’VESNA’;
*****
Operatori i njihov opis :
= Equal
<> Not equal. Note: In some versions of SQL this operator may be written as !=
> Greater than
< Less than >= Greater than or equal
<= Less than or equal
BETWEEN Between an inclusive range
LIKE Search for a pattern
IN To specify multiple possible values for a column
The AND operator displays a record if both the first condition AND the second condition are true.
The OR operator displays a record if either the first condition OR the second condition is true.
*****
SELECT column_name, column_name FROM table_name ORDER BY column_name ASC|DESC, column_name ASC|DESC;
*****
Kako povezati dve tabele u istoj bazi, tako da jednim upitom prikazujemo podatke iz obe tabele :
Tabele su : Orders i Customers, a kolone Orders.CustomerID i Customers.CustomerID su iste u obe tabele (tj preko njih se ove tabele mogu povezati).
Upit :
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID;
SQL joins are used to combine rows from two or more tables.
*****
WildCards :
% A substitute for zero or more characters – koristi se samo sa LIKE, ne sa =!!!!
_ A substitute for a single character – koristi se samo sa LIKE, ne sa =!!!!
[charlist] Sets and ranges of characters to match
[^charlist] or [!charlist] Matches only a character NOT specified within the brackets
*****
Spajanje podataka iz tabela
An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them.
The most common type of join is: SQL INNER JOIN (simple join). An SQL INNER JOIN returns all rows from multiple tables where the join condition is met (link).
The INNER JOIN keyword selects all rows from both tables as long as there is a match between the columns in both tables.
The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match.
The RIGHT JOIN keyword returns all rows from the right table (table2), with the matching rows in the left table (table1). The result is NULL in the left side when there is no match.
The FULL OUTER JOIN keyword returns all rows from the left table (table1) and from the right table (table2).
The FULL OUTER JOIN keyword combines the result of both LEFT and RIGHT joins.
Vizuelni prikaz (uzet odavde) :
visual_sql_joins_orig

Posted in Windows | Tagged , | Leave a comment

Kolač sa šargarepom

Oooo daaa, ispao je super!
Testo :
4 cela jajeta
2 čaše brašna
2 čaše šećera
1/2 case ulja
rendana šargarepa (ja sam stavila oko 1/2kg)
1 prašak za pecivo
100gr suvog grožđa
2/3 čaše seckanih oraha
1 kafena kašika cimeta (trebalo bi vise, bar za moj ukus)
malo mlevenog muskatnog oraščića

Peći u nauljenoj tepsiji, na oko 180C.
Evo kako ispadne :
carrot-cake3
Ja sam dodala preliv od čokolade (100gr čokolade za kuvanje, 100gr margarina I 2 vanil šećera) :
carrot-cake2
carrot-cake1
Sipala sam preliv na kolač koji je već isečen, pa se čokolada upila 🙂

Posted in Kuhinja | Tagged , , | Leave a comment

Oracle > 10g specifično i DB generalno – crtice

A database schema (ERD) is the skeleton structure that represents the logical view of the entire database. It defines how the data is organized and how the relations among them are associated. It formulates all the constraints that are to be applied on the data.
It’s the database designers who design the schema to help programmers understand the database and make it useful.
Database schema is the skeleton of database, and it does not contain ANY DATA.
*****
A database instance is a state of operational database with data at any given time. It contains a snapshot of the database.
Link.
*****
A table typically has a column or combination of columns that contain values that uniquely identify each row in the table. This column, or columns, is called the primary key (PK) of the table and enforces the entity integrity of the table. A table can contain only one primary key constraint.
A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. A FOREIGN KEY in one table points to a PRIMARY KEY in another table. The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables.
Link1
Link2
Link3.
*****
Neke skraćenice :
DBMS – Database Management System
*****
Oracle CC > 10g ima ekstra licence za neke dodatne pakete, a na korisnicima je da procene koji im paketi trebaju. Takođe : in Standard Edition or Standard Edition One there are no management packs. These can be purchased only with the Enterprise Edition.
Also : licensing is considered on a CPU basis.
Meni se kao najzanimljiviji čine :
Oracle Diagnostics Pack provides automatic performance diagnostic and advanced system monitoring functionality. It includes :
Automatic Database Diagnostic Monitor (ADDM) – An automated tool that focuses on the database’s most intensive operations, drilling down into the performance to proactively determine root cause.
Automatic Workload Repository (AWR) – A repository that collects statistics at predetermined intervals on the workloads within the database. The AWR provides an historical reference for performance changes over time, including establishment of performance baselines, and adds great value to the capacity planning process.
Active Session History (ASH) – A key component of AWR, ASH samples session activity every second and stores it in views, replacing the need for more manual utilities such as SQL trace. DBAs typically use the v$active_session_history view to isolate performance problems with individual database sessions.
Data Dictionary Views – With some exceptions, data dictionary views beginning with dba_addm, dba_hist or dba_advisor are part of these management packs, and accessing them trigger a licensing event.
——————
Oracle Tuning Pack provides database administrators with expert performance management for the Oracle environment, including SQL tuning and storage optimizations. Oracle Diagnostics Pack is a prerequisite product to Oracle Tuning Pack.
It includes :
SQL Access Advisor – Advice on how to optimize schema design in order to maximize query performance. This feature takes input from a variety of sources, including AWR, to analyze a workload and provides recommendations on index creation and deletion, partition creation, and materialized views creation.
SQL Tuning Advisor – Statistics analysis, SQL profiling, and access path analysis with recommendations on how to optimize SQL. There is also an automatic mode that allows the database to automatically implement recommendations for conditions in which at least a three-fold improvement would result.
Real-Time SQL Monitoring – The most frequent use of Tuning Pack is typically real-time SQL monitoring. If a production environment experiences a performance issue, this is the only way for a DBA to determine what SQL statements are running while the problem is occurring.
Data Dictionary Views – Access to the sql_monitor, and sql_plan_monitor views require Tuning Pack licenses.

Link1.
Link2.
*****

Posted in Unix | Tagged | Leave a comment

Oracle 13 + Solaris 11 – razne crtice

Oracle Solaris is optimized on both SPARC and x86 systems.
BUT :
Processors in the x86 family are based on the CISC (Complex Instruction Set Computers) architecture, while the SPARC (Scalable Processor Architecture) processor is based on the RISC (Reduced Instruction Set Computers) architecture philosophy.
A CISC processor uses more complex instructions, which can take multiple CPU cycles to complete, to perform operations.
A RISC processor uses more simplified instructions that can be executed in a single CPU cycle. The RISC architecture is therefore built for speed.
RISC is also much easier and more effective to implement as a multi-threaded/multi-core architecture than CISC because each thread and core is simpler and requires fewer resources, both in silicon and within the OS.
************
Stvari specifične za Solaris 11 :
SMF – Service Management Framework – Basically a replacement for init scripts
Projects – Resource controls
Zones – Kernel level virtual machines
ZFS – Volume manager/Pooled storage and file system all rolled into one
DTrace – Kernel/User debugging/monitoring utility
*************
Oracle Solaris communicates with peripheral devices through device files or drivers. A “device driver” is a low-level program that allows the kernel to communicate with a specific piece of hardware. The driver serves as the OS’s “interpreter” for that piece of hardware.
If a driver is not loaded for a particular peripheral device, that device is not functional.

Posted in Linux | Tagged | Leave a comment