Trajnim databaze – troubleshooting

Problemet e lidhura me: 1) Service, 2) Network, 3) Login

*Kontrollohet:

  1. A eshte SQL Service i ndezur si sherbim
    1. Master DB Corrupted?
    2. Model DB Corrupted?
    3. TempDB path not found?
  2. nslookup (name resolution) te SQL Server instance
  3. Ping Server IP
  4. A logohesh ne windows server ku eshte instalu SQL Server per te eleminuar Network-un. (Ketu logohesh me Shared Memory Protocol)
  5. A eshte TCP/IP (ose Named Pipes) Enabled ne SQL Server
  6. A duhet qe ky login te futet ne SQL Server?
    1. A eshte bere locked out?
    2. A ka permissions to connect?
  7. Nese autentikimi behet me Domain Controller a mund te lidhet SQL Server me Domain Controller?
  8. PER CDO GJE KONSULTOHU ME SQL SERVER LOG DHE WINDOWS SYSTEM LOG.

Database backups

–full backup (overwrite backupset, pa formatuar media set, me emer)

BACKUP DATABASE [testxml]
TO DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\testxml.bak’
WITH NOFORMAT, INIT, NAME = N’testxml-Full Database Backup’
GO

–differential backup (me append, me emer, dhe pa formatuar media set)

BACKUP DATABASE [testxml]
TO DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\testxml.bak’
WITH differential, NOFORMAT, NOINIT, NAME = N’testxml-Diff Database Backup’
GO

–Log backup (me append, me emer, dhe pa formatuar media set)

BACKUP LOG [testxml]
TO DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\testxml.bak’
WITH NOFORMAT, NOINIT, NAME = N’testxml-log Database Backup 2′
GO

**Vetem T-Log backup ben shkurtimin e LOG File, asnje backup tjeter.

**DBCC Shrinkfile rekomandohet te kryhet vetem mbas nje full backup.

databaze media set informacion

Per te pare informacionin ne nje mediaset ( bak file) e cila mund te kete nje ose me shume backup sets (backups) perdorim queries te meposhtem.

per media set-in

restore labelonly from disk=’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\testxml.bak’

per backup sets

restore headeronly from disk=’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\testxml.bak’

per files qe jane bere backup nga ky media set

restore filelistonly from disk=’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\testxml.bak’

Encrypt Database – create certificate

USE master;

GO

CREATE MASTER KEY ENCRYPTION BY PASSWORD = ‘test’;

go

CREATE CERTIFICATE MyServerCert WITH SUBJECT = ‘My test DEK Certificate’;

go

USE testxml;

GO

CREATE DATABASE ENCRYPTION KEY

WITH ALGORITHM = AES_128

ENCRYPTION BY SERVER CERTIFICATE MyServerCert;

GO

ALTER DATABASE testxml

SET ENCRYPTION ON;

GO

backup certificate MyServerCert to file=’C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\Backup\test_cert’;

Go

ALTER DATABASE testxml

SET ENCRYPTION OFF;

GO

SQL Login mismatch – not logohet mbasi ke bere nje backup -restore

use your_db

go

Per te kontrolluar users jetim (orphan)

exec sp_change_users_login ‘Report’

Per te lidhur nje user me nje login ekzistues mbasi nje backup/restore

exec sp_change_users_login ‘Update_One’, ‘myUser’,’mylogin’

Per te lidhur nje user me nje login nqs ekziston edhe nqs nuk ekziston ( e krijon on the fly)

exec sp_change_users_login ‘Auto_Fix’, ‘myUser’,’mylogin’,’Pa$$word’

Pasword e vendos vetem nese doni qe login te krijohet.

NQS deshironi te krijoni LOGIN nga e para dhe t’a lidhni vete atehere:

create login MyUserLogin with password =’Pa$$w0rd’, SID=’0x12345678987655444′

SID duhet t’a merrni nga SID i user-it nga komanda

exec sp_change_users_login ‘Report’

Detyra (3) Double Link List (ADT)

Programim C++ detyre, krijim dhe testing i nje double list link

cdouble-link-list.rar

Tirana Center of Technology

—————————driver.cpp———————-

//driver.cpp
//written to test doubly-linked list ADT
//ItemType must have << and >> operators defined

#include <fstream>
#include <iostream>
#include <string>
#include “sortlist.h”
using namespace std;

template <class ItemType>
void PrintAscending(ostream& dataFile, SortedType<ItemType>& list, string listName);
//pre: list has been initialized
//  dataFile is open for output
//post: each component in list has been written to dataFile
//  dataFile is still open

template <class ItemType>
void PrintDescending(ostream& dataFile, SortedType<ItemType>& list, string listName);
//pre: list has been initialized
//  dataFile is open for output
//post: each component in list has been written, in reverse order, to dataFile
//  dataFile is still open

void DisplayMenu(int& choice);
//pre: listA and listB have been initialized
//post: displays a menu for list operations

template <class ItemType>
void Insert(SortedType<ItemType>& list, string listName);
//pre: list has been initialized
//     item to insert is entered by the user in the function
//post: Calls the ADT InsertItem and prints a message indicating
//      success or failure

template <class ItemType>
void Delete(SortedType<ItemType>& list, string listName);
//pre: list has been initialized
//     item to delete is entered by the user within the function
//post: Calls the ADT delete function and prints a message
//      indicating success or failure.

template <class ItemType>
void Retrieve(SortedType<ItemType> list);
//pre:  none
//post: prompts user for item to retrieve from list; displays message
//        indicating whether or not item was found in the list

int main()
{
SortedType<int> listA, listB, listC;
int choice;
Continue reading “Detyra (3) Double Link List (ADT)”

Detyra (2) C++

Ne programin C++ bashkengjitur e ndertuar si detyre mesohen thirrjet e funksioneve ne nje program te nivelit mesatar. Programi tregon kohen e pritjes per meshkujt dhe per femrat per te perdorur VC publike.

cfunksionet-detyra-program.rar

Tirana Center of Technology

——–driver.cpp———————-

#include<string>
#include<iostream>
#include<fstream>
//the library when we use the clock and random number function
#include “Patron.h”
#include “Restroom.h”
#include “Input.h”
#include “Output.h”
#include “assign6.h”
using namespace std;

int main()
{
ofstream fout;
fout.open(“output.dat”);

int counter = 0;
do
{
//output

Output simOutputs;
simOutputs.numMenAttendingRest = 0;
simOutputs.numWomenAttendingRest = 0;
simOutputs.numMenUseRest = 0;
simOutputs.numWomenUseRest = 0;
simOutputs.totalMenWaitTime = 0;
simOutputs.totalWomenWaitTime = 0;
simOutputs.menLine = 0;
simOutputs.womenLine = 0;
Input simInputs;

int clock = 0;
double arrivalProbM, arrivalProbF;

Patron pF, pM;
getInput(simInputs, counter);
Restroom womenRoom(simInputs.numFemaleStalls), menRoom(simInputs.numMaleStalls);
arrivalPropability(simInputs, arrivalProbM, arrivalProbF);
for (clock; clock < simInputs.eventLength; clock++)
{
checkFemaleArrival(arrivalProbF, womenRoom, clock, pF, simOutputs);
checkMaleArrival(arrivalProbM, menRoom, clock, pM, simOutputs);
womenRoom.updateStalls();
menRoom.updateStalls();
femaleStallAvailable(womenRoom, pF, clock, simOutputs);
maleStallAvailable(menRoom, pM, clock, simOutputs);
}
//yetInLine(simOutputs);
displayOutput(counter, simInputs, simOutputs, menRoom, womenRoom);
}while(reGetInput());
fout.close();
return 0;
}

————————————————————