Merhabalar,
Eğer Database'iniz daha önceden ikinci yada diğer notlarda ise çıkartmışsanız yada bir şekilde AlwaysOn listenerdan cıkarmışsanız. Aşağıdaki adımlarla ve benim gibi görsel değilde komutlarla çalışmaya alışmışsanız hızlı bir şekilde alwayson'a alabilirsiniz..
1Adım:
A) eğer Dblerinizin sürekli full ve log backupları alınıyorsa aşağıdaki komutla backuplarınız alındığı pathleri çıkarın..
SELECT physical_device_name,
backup_start_date,
backup_finish_date,
backup_size/1024.0 AS BackupSizeKB
FROM msdb.dbo.backupset b
JOIN msdb.dbo.backupmediafamily m ON b.media_set_id = m.media_set_id
WHERE database_name = 'DATABASE_NAME'
ORDER BY backup_finish_date DESC
Çıkan sonuc ".bak" ile biten dosya pathlerinden itibaren full backuptan sıra ile yukarıya restore edilecek(şuanki zamana kadar alınan backupları).
B)Eğer hazırda backupınız yoksa bu komutlarla full ve log backuplar alınır..(ilk note da çalıştırılacak.)
BACKUP DATABASE DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME.bak'
WITH COPY_ONLY;
GO
BACKUP LOG DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME.trn'
WITH COPY_ONLY;
GO
2Adım: ikinci notda çalıştırılacak restore işlemleri(elimizde backuplar var şimdi eşitlemeye geldi)
RESTORE DATABASE DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME.bak'
WITH NORECOVERY, REPLACE,
MOVE 'vdk' TO 'W:\DATA\DATABASE_NAME.mdf',
MOVE 'vdk_log' TO 'X:\LOG\DATABASE_NAME_log.ldf';
GO
RESTORE LOG DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME4.trn' WITH NORECOVERY;
GO
RESTORE LOG DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME3.trn' WITH NORECOVERY;
GO
RESTORE LOG DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME2.trn' WITH NORECOVERY;
GO
RESTORE LOG DATABASE_NAME
FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME1.trn' WITH NORECOVERY;
GO
3ADIM:Eşitleme tamamlandı şimdi sıra lsn'eri eşitlemek kaldı..
--->>eğer daha önce hiç gruba alınmadısya alttaki komuıtla gruba alabilirsin.
ALTER AVAILABILITY GROUP [AO_GROUPNAME] ADD DATABASE [DATABASE_NAME]
go
--gruba alınmışsa zaten aşagıdaki komutla eşitlemeyi başlatabilir ve AlwaysOna alabilirsin.
ALTER DATABASE [vdk] SET HADR AVAILABILITY GROUP = AO_GROUPNAME;
go
4.ADIM:Eğer backupı alınmış db içeriğine bakmak istersen aşağıdaki komutla detaylarını listeleyebilirsin.
RESTORE FILELISTONLY FROM DISK = '\\10.10.10.12\backupfile\DATABASE_NAME1.bak'
MSSQL,SQL,SQL SERVER, SQL BACKUP, ALWAYSON
14 Şubat 2019 Perşembe
2 Ocak 2018 Salı
Sybase ASE Load ve Drop database hatası ve kısır döngü
Merhabalar,
Diyelimki VeriTabanı Load işleminde bu şekilde bir hata aldınız.
The log segment in the target database % is too small (% MB) to accommodate the log segment from the dumped database (% MB)
sizden LogSegmentin az yada cok olduğuınu söylüyor. bu durumda disk resize ederek sorunu aşağıdaki şekilde çözebilirsiniz
eğer hatada 15MegaByte'a ihtiyaç varsa aşağıdaki şekilde ekstra '15M' eklenebilirEğer GigaByte ise GigaByte eklenebilir '45G'
1> disk resize name='VT_log01', size= "15M"
2> go
1> alter database TEST_DB log on VT_log01 = "15M"
2> go
çalıştırdınız ama hata aldınız. Ne diyor.
An attempt was made to fetch logical page '%' from cache 'default data cache'. Page belongs to database '%' (12), object 'sysdepends' (12), index 'csysdepends' (2), partition 'csysdepends_12' (12) and not to database '%' (12), object 'sysreferences' (16), index 'sysreferences' (0), partition 'sysreferences_16' (16).
bu hatanın birçok sebebi olabilir. bunlardan biri de Dtabase Load ederken sizin tarafınızdan load işlemin kesilmesi yada bi şekilde kesilmiş olması. yani load tamamlanmadan load işlem kesildi ise bu hatayı alabilirsiniz.
yapmamız gereken. Database'i drop edip tekrardan create etmemiz.
1>drop database TEST_DB
dedik. :) Ancak bunda da hata alıyoruz.
An attempt was made to fetch logical page '%' from cache 'default data cache'. Page belongs to database '%' (12), object 'sysdepends' (12), index 'csysdepends' (2), partition 'csysdepends_12' (12) and not to database '%' (12), object 'sysreferences' (16), index 'sysreferences' (0), partition 'sysreferences_16' (16).
VeriTabanına ve disklerine zaten erişemiyoruz ki. Nasıl drop edelim.
Ozaman bizde VeriTabanını Repair yaparız.
dbcc dbrepair(TEST_DB,dropdb)
go
Database 'ebyn_arc' is not marked suspect. You cannot drop it with DBCC
yine hata verdi. Benim daha önceden işaretleme yaptığım birşey yok. bunu yapamazsın diyor.
O zman bizde Kısır döngüye giriyoruz. burada çıkmaz yoldayız. ne yapacağız.
Öncelikle sistem databaselerinin update yetkisini açacağız.
sp_configure "allow updates", 1
go
daha sonra database in statusunu değiştireceğiz. sonra sistem databaselerine erişimi kapatacağız. bunu yaparken sa logini ile yapmanız gerekmektedir.
daha sonra sistem database erişimi kaldırın.
1> sp_configure "allow updates", 0
2> go
sonra VeriTabanı instance ını kapatıyoruz tekrar açıyoruz.
1> shutdown with nowait
2> go
kapattıktan sonra tekrar açmayı Unix/Linux sistemlerde komutla windows sistemlerde servislerden açıyorsunuz.
daha sonra dbccrepair komutu ile databasei kaldırıyoruz.
1> dbcc dbrepair(TEST_DB,dropdb)
bundan sonrası artık size kalmış. VeriTabanını tekrardan create edeceksiniz.
iyi şanslar.
Diyelimki VeriTabanı Load işleminde bu şekilde bir hata aldınız.
The log segment in the target database % is too small (% MB) to accommodate the log segment from the dumped database (% MB)
sizden LogSegmentin az yada cok olduğuınu söylüyor. bu durumda disk resize ederek sorunu aşağıdaki şekilde çözebilirsiniz
eğer hatada 15MegaByte'a ihtiyaç varsa aşağıdaki şekilde ekstra '15M' eklenebilirEğer GigaByte ise GigaByte eklenebilir '45G'
1> disk resize name='VT_log01', size= "15M"
2> go
1> alter database TEST_DB log on VT_log01 = "15M"
2> go
çalıştırdınız ama hata aldınız. Ne diyor.
An attempt was made to fetch logical page '%' from cache 'default data cache'. Page belongs to database '%' (12), object 'sysdepends' (12), index 'csysdepends' (2), partition 'csysdepends_12' (12) and not to database '%' (12), object 'sysreferences' (16), index 'sysreferences' (0), partition 'sysreferences_16' (16).
bu hatanın birçok sebebi olabilir. bunlardan biri de Dtabase Load ederken sizin tarafınızdan load işlemin kesilmesi yada bi şekilde kesilmiş olması. yani load tamamlanmadan load işlem kesildi ise bu hatayı alabilirsiniz.
yapmamız gereken. Database'i drop edip tekrardan create etmemiz.
1>drop database TEST_DB
dedik. :) Ancak bunda da hata alıyoruz.
An attempt was made to fetch logical page '%' from cache 'default data cache'. Page belongs to database '%' (12), object 'sysdepends' (12), index 'csysdepends' (2), partition 'csysdepends_12' (12) and not to database '%' (12), object 'sysreferences' (16), index 'sysreferences' (0), partition 'sysreferences_16' (16).
VeriTabanına ve disklerine zaten erişemiyoruz ki. Nasıl drop edelim.
Ozaman bizde VeriTabanını Repair yaparız.
dbcc dbrepair(TEST_DB,dropdb)
go
Database 'ebyn_arc' is not marked suspect. You cannot drop it with DBCC
yine hata verdi. Benim daha önceden işaretleme yaptığım birşey yok. bunu yapamazsın diyor.
O zman bizde Kısır döngüye giriyoruz. burada çıkmaz yoldayız. ne yapacağız.
Öncelikle sistem databaselerinin update yetkisini açacağız.
sp_configure "allow updates", 1
go
daha sonra database in statusunu değiştireceğiz. sonra sistem databaselerine erişimi kapatacağız. bunu yaparken sa logini ile yapmanız gerekmektedir.
1> use master
2> go
1> begin transaction
2> update sysdatabases set status = 320
3> where name = 'TEST_DB'
4> go
kontorl edin gerçekten 1 tane mi kayıt etkilendi. sonra commitlemeyi yapın 1> commit transaction
2> go
daha sonra sistem database erişimi kaldırın.
1> sp_configure "allow updates", 0
2> go
sonra VeriTabanı instance ını kapatıyoruz tekrar açıyoruz.
1> shutdown with nowait
2> go
kapattıktan sonra tekrar açmayı Unix/Linux sistemlerde komutla windows sistemlerde servislerden açıyorsunuz.
daha sonra dbccrepair komutu ile databasei kaldırıyoruz.
1> dbcc dbrepair(TEST_DB,dropdb)
2> go
bundan sonrası artık size kalmış. VeriTabanını tekrardan create edeceksiniz.
iyi şanslar.
Etiketler:
allow updates,
dbccrepair,
drop database,
Load database,
log segment,
sp_configure,
sybase,
sybase ase,
sybase Load database,
sysdatabase
5 Aralık 2017 Salı
Fiziksel Okuma ve Mantıksal Okuma (Physical read and Logical read)
Soru — Vt'lerde Fiziksel okuma ve mantıksal okuma arasındaki fark nedir?
Cevap:
— Fiziksel Okuma Diskten okunan sayfa(Page)lar olarak tanımlanır.
— Mantıksal Okuma Bellekten okunan sayfa(Page)lar olarak tanımlanır. (RAM/cache).
Cevap:
— Fiziksel Okuma Diskten okunan sayfa(Page)lar olarak tanımlanır.
— Mantıksal Okuma Bellekten okunan sayfa(Page)lar olarak tanımlanır. (RAM/cache).
Etiketler:
fiziksel okuma,
logical,
mantıksal okuma,
physical,
SAP,
sybase,
sybase ase
17 Mart 2017 Cuma
BACKUP detected corruption in the database log hatası
Veri Tabanlarınızdan birinde eğer log corruption olmuşsa aşağıdaki yöntemi uygulayabilirsiniz.
hata
BACKUP detected corruption in the database log. Check the errorlog for more information.
Msg: 3049, Level: 16, State: 1, Procedure: , Line: 1
>[Error] Script lines: 1-2 --------------------------
BACKUP DATABASE is terminating abnormally.
Msg: 3013, Level: 16, State: 1, Procedure: , Line: 1
çözüm
trun back-up' ı alıyoruz CONTINUE_AFTER_ERROR option'u ile
BACKUP LOG [MyDb]
TO DISK = N'C:\\MyDb.trn'
WITH NOFORMAT, NOINIT, NAME = N'MyDb', SKIP, NOREWIND,
NOUNLOAD, COMPRESSION, STATS = 10, NO_CHECKSUM, CONTINUE_AFTER_ERROR
GO
sonra full back-up alarak devam edebilirsiniz her ihtimale karşı elimizde bulunsun
BACKUP DATABASE [MyDb] TO DISK = N'C:\\MyDb.bak' WITH NOFORMAT, NOINIT, NAME = N'VDK-DRIVE', SKIP, REWIND, NOUNLOAD, STATS = 10
kolay gelsin..
hata
BACKUP detected corruption in the database log. Check the errorlog for more information.
Msg: 3049, Level: 16, State: 1, Procedure: , Line: 1
>[Error] Script lines: 1-2 --------------------------
BACKUP DATABASE is terminating abnormally.
Msg: 3013, Level: 16, State: 1, Procedure: , Line: 1
çözüm
trun back-up' ı alıyoruz CONTINUE_AFTER_ERROR option'u ile
BACKUP LOG [MyDb]
TO DISK = N'C:\\MyDb.trn'
WITH NOFORMAT, NOINIT, NAME = N'MyDb', SKIP, NOREWIND,
NOUNLOAD, COMPRESSION, STATS = 10, NO_CHECKSUM, CONTINUE_AFTER_ERROR
GO
sonra full back-up alarak devam edebilirsiniz her ihtimale karşı elimizde bulunsun
BACKUP DATABASE [MyDb] TO DISK = N'C:\\MyDb.bak' WITH NOFORMAT, NOINIT, NAME = N'VDK-DRIVE', SKIP, REWIND, NOUNLOAD, STATS = 10
kolay gelsin..
10 Mart 2017 Cuma
ubuntuda windows alanı mount etme (mounting windows share on ubuntu )
öncelikle cifs ' i yükleyeceğiz
# sudo apt-get install cifs-utils
linuxde id komutu ile group ve user id kodunu bulun(büyük ihtimal ikisi de 1000 dir)
#id
şimdi mount komutunu çalıştırabiliriz.
# sudo mount //WINSRV/SHARE -t cifs -o uid=1000,gid=1000,username=winuser /mnt/path
örnek:
#sudo mount //10.1.2.3/share -t cifs -o uid=1000,gid=1000,username=IBRAHIMPEKTAS,domain=BIM /mnt/share
bu kadar
:)
# sudo apt-get install cifs-utils
linuxde id komutu ile group ve user id kodunu bulun(büyük ihtimal ikisi de 1000 dir)
#id
şimdi mount komutunu çalıştırabiliriz.
# sudo mount //WINSRV/SHARE -t cifs -o uid=1000,gid=1000,username=winuser /mnt/path
örnek:
#sudo mount //10.1.2.3/share -t cifs -o uid=1000,gid=1000,username=IBRAHIMPEKTAS,domain=BIM /mnt/share
bu kadar
:)
Etiketler:
cifs,
cifs mount,
cifs-utils,
linux,
mount,
share,
ubuntu,
ubuntu 14.04,
windows cifs,
winshare
28 Kasım 2016 Pazartesi
ubuntu rdesktop "ERROR: recv: Connection reset by peer" hatası
ubuntudan Widows makinalara bağlantıda bu tarz hatalar alınıyorsa
windowsta seçili olan sadece rdp'ye izin ver seçeneğini kaldırmanız gerekir.
ubuntu rdesktop "ERROR: recv: Connection reset by peer" hatası
winowsta
Alt + x
Run
SystemPropertiesRemote.exe + ENTER
kaldırın "Allow connections only from computers running Remote Desktop with
Network Level Authentication (recommended).
Linux^te
# rdesktop -z -k it -u $MYUSER -z -g 1250x720 -p '$password' -d $MYDOMAIN $HOSTNAME -r sound:local
yada
remmina desktop^ta giriş yapmak için advance ayarlarında şu değişikliği yapmanız gerekebilir.
windowsta seçili olan sadece rdp'ye izin ver seçeneğini kaldırmanız gerekir.
ubuntu rdesktop "ERROR: recv: Connection reset by peer" hatası
winowsta
Alt + x
Run
SystemPropertiesRemote.exe + ENTER
kaldırın "Allow connections only from computers running Remote Desktop with
Network Level Authentication (recommended).
Linux^te
# rdesktop -z -k it -u $MYUSER -z -g 1250x720 -p '$password' -d $MYDOMAIN $HOSTNAME -r sound:local
yada
remmina desktop^ta giriş yapmak için advance ayarlarında şu değişikliği yapmanız gerekebilir.
20 Ocak 2016 Çarşamba
Send mails from command line
Install the mailx command
On Ubuntu/Debian based systems the mailx command is available from 2 different packages -1. heirloom-mailx
2. bsd-mailx
We shall be using the heirloom-mailx package because it has more features and options.
On CentOS/Fedora based systems, there is only one package named "mailx" which is the heirloom package.
To find out what mailx package is installed on your system, check the "man mailx" output and scroll down to the end and you should see some useful information.
# ubuntu/debian $ sudo apt-get install heirloom-mailx # fedora/centos $ sudo yum install mailx
Using the mailx command
Once installed, the mailx command can be directly referenced with the name mail, so you just type in that in the command line.1. Simple mail
Run the following command, and then mailx would wait for you to enter the message of the email. You can hit enter for new lines. When done typing the message, press Ctrl+D and mailx would display EOT.After than mailx automatically delivers the email to the destination.
$ mail -s "This is the subject" someone@example.com Hi someone How are you I am fine Bye EOT
2. Take message from a file
The message body of the email can be taken from a file as well.$ mail -s "This is Subject" someone@example.com < /path/to/file
The message can also be piped using the echo command -
$ echo "This is message body" | mail -s "This is Subject" someone@example.com
3. Multiple recipients
To send the mail to multiple recipients, specify all the emails separated by a comma$ echo "This is message body" | mail -s "This is Subject" someone@example.com,someone2@example.com
4. CC and BCC
The "-c" and "-b" options can be used to add CC and BCC addresses respectively.$ echo "This is message body" | mail -s "This is Subject" -c ccuser@example.com someone@example.com
5. Specify From name and address
To specify a "FROM" name and address, use the "-r" option. The name should be followed by the address wrapped in "<>".$ echo "This is message body" | mail -s "This is Subject" -r "Harry" someone@example.com
6. Specify "Reply-To" address
The reply to address is set with the internal option variable "replyto" using the "-S" option.# replyto email $ echo "This is message" | mail -s "Testing replyto" -S replyto="mark@gmail.com" someone@example.com # replyto email with a name $ echo "This is message" | mail -s "Testing replyto" -S replyto="Mark" someone@example.com
7. Attachments
Attachments can be added with the "-a" option.$ echo "This is message body" | mail -s "This is Subject" -r "Harry" -a /path/to/file someone@example.com
8. Use external SMTP server
This is an exclusive feature, that you get only with heirloom mailx and not bsd mailx, or the mail command from gnu mailutils or the mutt command.The mailx command can use an external smtp server to use to relay the message forward. The syntax is a bit lengthy but makes sense.
$ echo "This is the message body and contains the message" | mailx -v -r "someone@example.com" -s "This is the subject" -S smtp="mail.example.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="someone@example.com" -S smtp-auth-password="abc123" -S ssl-verify=ignore yourfriend@gmail.comHere is a breakdown
$ echo "This is the message body and contains the message" | mailx -v \ > -r "someone@example.com" \ > -s "This is the subject" \ > -S smtp="mail.example.com:587" \ > -S smtp-use-starttls \ > -S smtp-auth=login \ > -S smtp-auth-user="someone@example.com" \ > -S smtp-auth-password="abc123" \ > -S ssl-verify=ignore \ > yourfriend@gmail.comYou can use the gmail smtp servers and send emails via your gmail account. That is so cool!
9. Verbose - watch smtp communication
When using external smtp servers, you can choose to watch the entire smtp communication that is done in the background. This is useful specially when testing or debugging smtp servers.$ echo "This is the message body and contains the message from heirloom mailx" | mailx -v -s "This is the subject" -S smtp="smtp.gmail.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="mygmail@gmail.com" -S smtp-auth-password="mypassword" -S ssl-verify=ignore someone@example.com Resolving host smtp.gmail.com . . . done. Connecting to 74.125.68.109:587 . . . connected. 220 mx.google.com ESMTP je4sm32812877pbd.94 - gsmtp >>> EHLO enlightened 250-mx.google.com at your service, [122.163.43.21] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 >>> STARTTLS 220 2.0.0 Ready to start TLS >>> EHLO enlightened 250-mx.google.com at your service, [122.163.43.21] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 >>> AUTH LOGIN 334 VXNlcm5hbWU6 >>> Ymx1ZWJ1enppdEBnbWFpbC5jb20= 334 UGFzc3dvcmQ6 >>> KnJpc2hhYmgzKg== 235 2.7.0 Accepted >>> MAIL FROM:250 2.1.0 OK je4sm32812877pbd.94 - gsmtp >>> RCPT TO: 250 2.1.5 OK je4sm32812877pbd.94 - gsmtp >>> DATA 354 Go ahead je4sm32812877pbd.94 - gsmtp >>> . 250 2.0.0 OK 1417930703 je4sm32812877pbd.94 - gsmtp >>> QUIT 221 2.0.0 closing connection je4sm32812877pbd.94 - gsmtp
Troubleshooting
In case the mails are not being delivered properly you need to check a few things. The first thing to check is that an smtp server (mta) is running locally. The netstat command can tell that$ sudo netstat -ltnp | grep 25 [sudo] password for enlightened: tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2541/master tcp6 0 0 :::25 :::* LISTEN 2541/masterIf an stmp server like Postfix is running and still mails are not going, then try re-configuring Postfix for example. On Ubuntu/Debian systems, this can be done with the dpkg-reconfigure command
$ sudo dpkg-reconfigure postfixThen retry, the mail command and it should work. If it still doesn't, try contacting your server provider.
Source: binarytides
Kaydol:
Kayıtlar (Atom)