Friday, March 28, 2014

SSRS Ampeln (KPI) in VS2008 BI

Manchmal "leuchten" alle Ampeln (trotz Gegenteiliger Bedingungen) eines SSRS Reports im Preview des VS2008 Business Intelligence Studios, dann hilft es das Visual Studio zu schießen und neu zu öffnen.

Tuesday, March 25, 2014

Bindingnavigator manual Delete

BindingNavigator.DeleteItem = null; //manual Delete this.bindingNavigatorDeleteItem.Click += new System.EventHandler(this.bindingNavigatorDeleteItem_Click); private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Wirklich löschen / Sure to delete ?", "Confirm / Bestätigen", MessageBoxButtons.YesNo)) { bindingsource.RemoveCurrent(); } }

Monday, March 24, 2014

sql server: restore many transactionlogs

example of restoring sql server transaction logs to a full backup: beispiel einiger Befehlszielen um transaktionslogs wiederherzustellen:
RESTORE LOG [CrmBak] FROM DISK = N'E:\SqlServerBackup\CRM\CRM_backup_2014_01_01_230431_6398282.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10
RESTORE LOG [CrmBak] FROM DISK = N'E:\SqlServerBackup\CRM\CRM_backup_2014_01_02_230438_1759387.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10
RESTORE LOG [CrmBak] FROM DISK = N'E:\SqlServerBackup\CRM\CRM_backup_2014_01_03_230429_5963993.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10
to generate the restore command lines I used commandline: dir >dir.txt then with notepad++ I removed the date /time columns by pressing alt+marking with mouse, then used edit/Column editor to insert restore.... before the filename and ' WITH FILE=1 ... after the filename
um die Restore Befehle zu erzeugen, verwendetete ich den DOS BEfehel DIR: dir> dir.txt dann mit notepadd++ mit gedrückter alt taste mit der maus die unerwünschten spalten markeiren und löschen, dann mit edit / Column editor fügte ich vor dem dateinamen restore ... und nach dem DAteinamen 'WITH FILE=1 ... hinzu

wenn ein transaktionslog fehlt oder das zugrundeliegende full backup nicht in den Zeitraum des transaktionslogs fällt erhält man: Meldung 4305, Ebene 16, Status 1, Zeile 1 Das Protokoll in diesem Sicherungssatz beginnt bei LSN 29111000000034100001. Diese liegt für eine Anwendung auf die Datenbank nicht weit genug zurück. Eine frühere Protokollsicherung, die LSN 29015000000200600001 einschließt, kann wiederhergestellt werden. Meldung 3013, Ebene 16, Status 1, Zeile 1 RESTORE LOG wird fehlerbedingt beendet.

Tuesday, March 18, 2014

Sql Server TSQL Script: Backup ALL Databases (foult tolreant / Fehlertolerant)

--TODO: Enter Profilename and Email ADress at last statement DECLARE @name VARCHAR(50) -- database name DECLARE @path VARCHAR(256) -- path for backup files DECLARE @fileName VARCHAR(256) -- filename for backup DECLARE @fileDate VARCHAR(20) -- used for file name DECLARE @FEHLER VARCHAR(MAX) DECLARE @MSG VARCHAR(MAX) SET @path = 'F:\Backup\' SET @Msg='' SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) DECLARE db_cursor CURSOR FOR SELECT name FROM MASTER.dbo.sysdatabases WHERE name NOT IN ('master','model','msdb','tempdb') OPEN db_cursor FETCH NEXT FROM db_cursor INTO @name WHILE @@FETCH_STATUS = 0 BEGIN SET @fileName = @path + @name + '_' + @fileDate + '.BAK' BEGIN TRY print 'BACKUP DATABASE '+@name+' TO DISK = '+@fileName; BACKUP DATABASE @name TO DISK = @fileName END TRY BEGIN CATCH set @Fehler= 'Error: BACKUP DATABASE '+@name+' TO DISK = '+@fileName print @Fehler set @MSG=@MSG+@Fehler END CATCH FETCH NEXT FROM db_cursor INTO @name END CLOSE db_cursor DEALLOCATE db_cursor --SEND Mail - use SSMS Management DatabaseMAil right click Send Testmail to get Profilename and test mail (and set up if needed EXEC msdb.dbo.sp_send_dbmail @profile_name = 'ProfileName', @recipients = 'x@y.z', @body = 'Backup Bericht SQLServer (wenn leer keine Fehler)', @subject = @MSG ;

Thursday, March 13, 2014

create sql server login when not exists

if (SELECT SUSER_ID('test')) is null begin create login test with password='pwd' end

Tuesday, March 11, 2014

disk queue length - Festplatten Warteschlange

In Windows resource Monitor, the disk queue length Counter should be lower then 2, if ist greater then 5 there is a serious Problem. experience: coping large amount of mixed files: disk queue length 1-2 coping large file on same disk: disk queue length 2-5 idle: 0 hyperV Server with raid 10, 13 virtual machines: disk queue length 1

Thursday, March 06, 2014

Vsiaul Studio 2008 + Team Foundation Server 2010


Visual Studio 2008 mit TFS2010 nutzen:
1. SP1 für VS2008 installieren (wurde TeamFoundationExplorer nach SP1 installation installiert muss SP1 Setup nochmals ausgeführt werden.)

2. Compatibility Patch installieren (Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010)

3. Team Foundation Server als http://tfsservername:8080/tfs/DefaultCollection hinzufügen, oder in registry - richtige VS Version (9) statt 10 wählen:
 
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Instances\tfs01]
"Uri"="http://tfs01:8080/tfs"
"Type"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Instances\tfs01\Collections]
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Instances\tfs01\Collections\DefaultCollection]
"Uri"="http://tfs01:8080/tfs/defaultcollection"
"Type"=dword:00000001
 
 

Desktop Symbole ohne Admin Rechte verschieben


Als normaler Benutzer darf man Desktop Symbole, die man nicht selbst angelegt hat, nicht löschen oder verschieben. Damit das doch geht, einfach vollzugriff auf C:\Users\Public\Desktop (bzw %public%\desktop) setzen, z.b. der Users group des lokalen Rechners oder gleich den Domain Benutzern Vollzugriff geben:

Wednesday, February 26, 2014

creating Table on secondary filegroup on sql server / eine Tabelle in der zweiten Filegroup anlegen am Sql Server

angenommen die Datenbank
asuming the database has a filegroup named "secondary":

create table tSecondary
(
    Id integer
)
on 'Secondary'

windows username, hostname, domainname by cmd (commandline)

benutzername / username:
echo %username%
or /oder
whoami

rechnername / hostname:
hostname

domainname:
echo %userdomain%
or / oder
systeminfo

Tuesday, February 11, 2014

Webservice for / für sharepoint List

sharepint List Adress: myserver/Intranet/mysite/Lists/mylist/Allitems.aspx
Webservice Adress: myserver/Intranet/mysite/_vti_bin/Lists.asmx

Thursday, February 06, 2014

Tuesday, February 04, 2014

sql server datenbank offline nehmen / take database offline / verbindungen lsöchen / kill connections

use master
go
ALTER DATABASE GBOv2_Reports_Test
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO


alle Verbindungen zu einer db killen / delete all Connections to a db
declare @kill varchar(8000) = '';
select @kill=@kill+'kill '+convert(varchar(5),spid)+';'
    from master..sysprocesses
where dbid=db_id('GBOv2_Reports_Test');
exec (@kill);


-- Show all processes of SQL Server / alle processe (Verbindungen) des SQL Servers anzeigen
select * from master..sysprocesses

Sunday, February 02, 2014

windows 7 mbr reparieren - fixmbr - fdisk /fixmbr - bootrec.exe /fixmbr

In der Windows 7 wiederherstellungskonsole verwendet man bootrec.exe /fixmbr statt früher aus msdos fdsik /fixmbr

Thursday, January 30, 2014

linux ftp server vsftpd

feststellen ob der ftp Dämon läuft:

netstat -a | grep ftp

in etc/VSFTPD liegt das config file
in etc/ftpusers sind user aufgelistet, die kein ftp machen dürfen (z.b. root)

user sieht normalerweise sein home dir

remote desktop

Allgemein


Version feststellen cat /etc/*-release

sudo reboot
sudo poweroff
sudo shutdown

Nano Texteditor

Select: ALT + M + A
Copy: ALT + 6
Paste: CTRL + U

Zeile ausschneiden: CRTL +K

SUCHEN: CRTL-W

User

user anzeigen: cat /etc/passwd
benutzer hinzufügen: sudo adduser BENUTZERNAME
Passwort ändern: sudo passwd BENUTZERNAME
Benutzer zu einer Gruppe hinzufügen: sudo usermod -aG gruppenname Username
gruppe hinzufügen: sudo groupadd www

Netzwerk

ifconfig

ftpclient: sudo apt-get ftp

ssh xxx.yyy.zzz.aaa -l loginname


Crontab (not crone)

alle einträge listen: crontab -l
edit bzw erstmalig erzeugen: crontab -e

*/1 * * * * $HOME/test.py >> test.log 2>&1

jede minute test.py starten und in test.log schreiben

test.py:
#!/usr/bin/env python
import time
print(time.strftime("%d.%m.%Y %H:%M:%S"))


Installierete Software

dpkp -l > pakete.txt
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)

Disk Partitionen

ls /dev/
ls /mnt/
mount
mmcblk0 ... SdCard0
sda ... SolidDriveA (Hard Disk A)

sudo fdisk -l

sudo blkid -o list
df -h  ... DiskFree -human readable
cat /proc/partitions
sudo fdisk /dev/mmcblk0
p ... list partition
q ... quit without writing

Dateien / Files

Datein mit rechte usw: ls -l
rechte: owner/gruppe/other

freier Speicherplatz auf den HDs: df -h
Dir anzeigen: ls
alle Dateien listen: ls -a
suchen: find / -Name ftp* sucht alle Dateien mit ftp

löschen: rm
kopieren von Bäumen (-r) ohne überschreiben existierender Dateien (-n) und Ausgabe der gerade kopierten Datei --verbose
cp --verbose -rn quelle ziel

Rechte anzeigen: ls-l   (owner gruppe andere, username gruppenname )
chmod 774 datei

Owner ändern:
chown -c user:gruppe datei

zu anderem linux rechner kopieren:
scp myfile user@192.168.1.8:


standard Dirs:


1. / – Root

Every single file and directory starts from the root directory.
Only root user has write privilege under this directory.
Please note that /root is root user’s home directory, which is not same as /.
2. /bin – User Binaries

Contains binary executables.
Common linux commands you need to use in single-user modes are located under this directory.
Commands used by all the users of the system are located here.
For example: ps, ls, ping, grep, cp.
3. /sbin – System Binaries

Just like /bin, /sbin also contains binary executables.
But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
For example: iptables, reboot, fdisk, ifconfig, swapon
4. /etc – Configuration Files

Contains configuration files required by all programs.
This also contains startup and shutdown shell scripts used to start/stop individual programs.
For example: /etc/resolv.conf, /etc/logrotate.conf
5. /dev – Device Files

Contains device files.
These include terminal devices, usb, or any device attached to the system.
For example: /dev/tty1, /dev/usbmon0
6. /proc – Process Information

Contains information about system process.
This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
This is a virtual filesystem with text information about system resources. For example: /proc/uptime
7. /var – Variable Files

var stands for variable files.
Content of the files that are expected to grow can be found under this directory.
This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);
8. /tmp – Temporary Files

Directory that contains temporary files created by system and users.
Files under this directory are deleted when system is rebooted.
9. /usr – User Programs

Contains binaries, libraries, documentation, and source-code for second level programs.
/usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
/usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
/usr/lib contains libraries for /usr/bin and /usr/sbin
/usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2
10. /home – Home Directories

Home directories for all users to store their personal files.
For example: /home/john, /home/nikita
11. /boot – Boot Loader Files

Contains boot loader related files.
Kernel initrd, vmlinux, grub files are located under /boot
For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic
12. /lib – System Libraries

Contains library files that supports the binaries located under /bin and /sbin
Library filenames are either ld* or lib*.so.*
For example: ld-2.11.1.so, libncurses.so.5.7
13. /opt – Optional add-on Applications

opt stands for optional.
Contains add-on applications from individual vendors.
add-on applications should be installed under either /opt/ or /opt/ sub-directory.
14. /mnt – Mount Directory

Temporary mount directory where sysadmins can mount filesystems.
15. /media – Removable Media Devices

Temporary mount directory for removable devices.
For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer
16. /srv – Service Data

srv stands for service.
Contains server specific services related data.
For example, /srv/cvs contains CVS related data.

Thursday, January 23, 2014

Webservice Proxy Klasse c# in Visual Stuido erzeugen

VS2008:
1) unter References add Service Referenc
2) unter Advanced Add Web Reference
3) Url eingeben (wdsl)  => zeigt Servicenamen und Methodennamen an, schlägt Web Reference Name vor, diesen anpassen
4) es wird Code unter WebReferences\WebReferenceName\Reference.cs erzeugt, die wichtigste Klasse heißt genauso wie das Service (unter 3 angezeigt)

Tuesday, January 21, 2014

Wednesday, January 15, 2014

oracle simple package

Header:
CREATE OR REPLACE
PACKAGE PA_PDB_UTIL AS

PROCEDURE P_PDB_SeekId (inId IN VARCHAR2, ret OUT integer);

END PA_PDB_UTIL;

Body:
CREATE OR REPLACE
PACKAGE BODY PA_PDB_UTIL AS

  PROCEDURE P_PDB_SeekId (inId IN VARCHAR2, ret OUT integer) AS
  BEGIN
      dbms_output.put_line ('beginn!');
      dbms_output.put_line (inPannenId);
      select count(*) into ret from test where Id=inId;
      dbms_output.put_line (ret);
      dbms_output.put_line ('End');
    NULL;
  END P_PDB_SeekId;

END PA_PDB_UTIL;

Testen mit:
set serveroutput on;  
declare ret integer;
begin
 PA_PDB_UTIL.P_PDB_SeekPannenId('test', ret);
end;

Tuesday, January 14, 2014

oracle top cpu time sql

SET pages 3000
SET LINES  120
SET trimspool ON
SET trimout   ON

COLUMNS sql_text FORMAT a40 word_wrapped HEAD 'SQL|Text'
COLUMNS cpu_time       HEAD 'CPU|Time'
COLUMNS elapsed_time   HEAD 'Elapsed|Time'
COLUMNS disk_reads     HEAD 'Disk|Reads'
COLUMNS buffer_gets    HEAD 'Buffer|Gets'
COLUMNS rows_processed HEAD 'Rows|Processed'


TTITLE 'SQL-Statements nach CPU-Nutzung'


SELECT * FROM
     (SELECT sql_text,
             cpu_time/1000000 cpu_time,
             elapsed_time/1000000 elapsed_time,
             disk_reads,
             buffer_gets,
             rows_processed
      FROM   v$sqlarea Where SQL_Text Like '%T_PDB_%'
      ORDER BY cpu_time DESC
)

WHERE rownum <=25;