meine Sys/Db admin & Developper Notitzen - wer Rechtschreibfehler findet darf sie behalten ... my Sys/Db Admin and developper notes - I don't care about typos
Wednesday, October 24, 2012
batch file pruefen ob parameter uebergeben wurde
@echo off
echo start
if X%1X==XX goto ende
echo commandozeilen parameter 1 wurde uebergeben
:ende
echo ende
Monday, October 22, 2012
Oracle Bildschirmausgabe basics (if, dbms_output)
prompt 'bildschirmausgabe in sql scripts - in stored Proc dbms_output.put_line verwenden'
-- damit dbms_output.put_line('Bildschrimasugabe in PL SQL Blocks (Stored Proc.)'); funktioniert
set serveroutput on;
begin
dbms_output.put_line('Bildschrimasugabe in PL SQL Blocks (Stored Proc.)');
if (1=0) THEN
dbms_output.put_line('true');
else
dbms_output.put_line('false');
end if;
end;
Tuesday, October 16, 2012
refresh / recompile sql server Inline table valued Functions / Tabellenwert Funktionen aktualisieren
select 'exec sp_refreshsqlmodule '+name from sys.objects where type='IF' and schema_id=1
ergebnis kopieren und ausführen
type="IF" Inline Function
ergebnis kopieren und ausführen
type="IF" Inline Function
Monday, October 15, 2012
powershelll erste schritte
in powershell ausführung von unsigned scripts zulaassen:
Set-ExecutionPolicy RemoteSigned
powershell e:\SendMail.ps1
e:\SendMail.ps1:
#gwmi win32_operatingsystem
Write-Host "Sending Email"
#SMTP server name
$smtpServer = "mail.server.com"
$cred = new-object Net.NetworkCredential("user", "pwd!")
#Creating a Mail object
$msg = new-object Net.Mail.MailMessage
#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Credentials = $cred
#Email structure
$msg.From = "x@y.z"
$msg.ReplyTo = "x@y.z"
$msg.To.Add("x@y.z")
$msg.subject = "test"
$msg.IsBodyHTML = $true
$msg.body ="
------------ Backup: ---------------------"
$msg.Attachments.Add('c:\bat\report.txt')
#Sending email
$smtp.Send($msg)
Write-Host "Email Sent"
Set-ExecutionPolicy RemoteSigned
powershell e:\SendMail.ps1
e:\SendMail.ps1:
#gwmi win32_operatingsystem
Write-Host "Sending Email"
#SMTP server name
$smtpServer = "mail.server.com"
$cred = new-object Net.NetworkCredential("user", "pwd!")
#Creating a Mail object
$msg = new-object Net.Mail.MailMessage
#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Credentials = $cred
#Email structure
$msg.From = "x@y.z"
$msg.ReplyTo = "x@y.z"
$msg.To.Add("x@y.z")
$msg.subject = "test"
$msg.IsBodyHTML = $true
$msg.body ="
------------ Backup: ---------------------"
$msg.body += Get-Content e:\backuplog.txt
$msg.Attachments.Add('c:\bat\report.txt')
#Sending email
$smtp.Send($msg)
Write-Host "Email Sent"
Friday, October 05, 2012
Oracle Nationalen Zeichensatz (Collation) ändern:
Der NLS Nationale Zeichensatzin Oracle, den man beim Erzeugen der Db angibt kann wie folg ausgelesen werden:
SELECT parameter, value FROM nls_database_parameters WHERE parameter LIKE 'NLS_NCHAR_CHAR%';
und so geändert werden (nicht supported):
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16;
SHUTDOWN IMMEDIATE;
bzw ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE UTF8;
Wednesday, September 05, 2012
Oracle Basics
Db connectionstrings stehen am server in:
C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
Sqlplus verbindet sich immer zu der db, die in Umgebungsvariable ORACLE_SID steht, außer man verwendet diesen syntax:
sqlplus "sys/password@dbFromTns as sysdba"
test abfrage:
select table_Name from user_tables;
Tuesday, August 28, 2012
Oracle imp / impdp
impdp (ab oracle 10g)
wichtig - dumpfile muß im directory C:\oracle\product\10.2.0\admin\DATABASENAME\dpdump liegen und ORACLE_SID Umgebungsvariable auf die Db, in die importiert werden soll zeigen
C:\oracle\product\10.2.0\admin\LDLDeploy\dpdump>impdp dumpfile=PSA20120515.DMP Import: Release 10.2.0.1.0 - Production on Monday, 27 August, 2012 14:33:00 Copyright (c) 2003, 2005, Oracle. All rights reserved. Username: sys as sysdba Password: Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting "SYS"."SYS_IMPORT_FULL_01": sys/******** AS SYSDBA dumpfile=P20120515.DMP Processing object type SCHEMA_EXPORT/USER
welche schemas sind im dmp file ?
mit notepad++ oder ähnlichem öffnen und nach OWNER_NAME suchen
imp (vor oracle10g, wird aber bei 10 und 11 auch noch mitgeliefert)
der user steht in der 2. zeile des dumps ab Zeichen 2 (1. Zeichen ist D):
TEXPORT:V09.02.00
DUSER
RTABLES
wichtig - dumpfile muß im directory C:\oracle\product\10.2.0\admin\DATABASENAME\dpdump liegen und ORACLE_SID Umgebungsvariable auf die Db, in die importiert werden soll zeigen
C:\oracle\product\10.2.0\admin\LDLDeploy\dpdump>impdp dumpfile=PSA20120515.DMP Import: Release 10.2.0.1.0 - Production on Monday, 27 August, 2012 14:33:00 Copyright (c) 2003, 2005, Oracle. All rights reserved. Username: sys as sysdba Password: Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting "SYS"."SYS_IMPORT_FULL_01": sys/******** AS SYSDBA dumpfile=P20120515.DMP Processing object type SCHEMA_EXPORT/USER
welche schemas sind im dmp file ?
mit notepad++ oder ähnlichem öffnen und nach OWNER_NAME
TEXPORT:V09.02.00
DUSER
RTABLES
Sunday, August 26, 2012
Windows 8 Product Key ändern
In Systemsteuerung / System / Windows Activation gibt es nicht wie bei Windows 7 die Möglichkeit den product key zu ändern, aber mittels vb scrip von einer administrativen sell ist es möglich:
slmgr.vbs -ipk "neuer Product Key"
Thursday, August 23, 2012
Tabellen Speicherplatz: sp_spaceused
exec sp_spaceused tLog
exec sp_spaceused tLog1
exec sp_spaceused tAdressen
Wednesday, August 22, 2012
Sql Server Page Dump
dbcc traceon(3604)
dbcc IND(Datenbank,Tabelle,-1)
dbcc PAGE(datenbank,FileId,PagePID,3) -- FileId =1 PagePID von dbcc IND
Tuesday, August 07, 2012
from SqlServer to Oracle
sql database servcie default port 1433 - oracle listener def. port 1521
lassen sich mit telnet hostname port verifizieren ob sie laufen
Der Listener wird mit Net Configuration Assistent konfiguriert,
der Aministrations Assistent von Windows zeigt an welche Listener und admins es gibt
Datenbanken werden mit dem Database Configuration Assistent angelegt
In C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN ist das tnsnames.ora und andere config files
WSS Wiki aus dem SQL Server
Wollte mal wissen, wo die Wiki Einträge am Sharepoint in der dahinterliegenden SQL Server Datenbank abgelegt werden:
Wiki ist Liste von HTML Seiten, [[WikiSeitenname]] wird auf Link
<a class=ms-wikilink href="/myWiki/Home.aspx">Home</a> umgewandelt
und werden in CONTEN_Portal abgelegt:
select ui.tp_login,du.tp_Dirname,du.tp_leafname,du.tp_version,du.tp_author,du.ntext2, du.tp_created,du.tp_editor,du.Tp_modified,*
from AllUserData du join UserInfo ui on du.tp_editor=ui.tp_id
where tp_contenttype like 'Wiki%'
order by du.tp_leafname,du.tp_version
weitere Sql Queries auf die Sharepoint Content Db
Wiki ist Liste von HTML Seiten, [[WikiSeitenname]] wird auf Link
<a class=ms-wikilink href="/myWiki/Home.aspx">Home</a> umgewandelt
und werden in CONTEN_Portal abgelegt:
select ui.tp_login,du.tp_Dirname,du.tp_leafname,du.tp_version,du.tp_author,du.ntext2, du.tp_created,du.tp_editor,du.Tp_modified,*
from AllUserData du join UserInfo ui on du.tp_editor=ui.tp_id
where tp_contenttype like 'Wiki%'
order by du.tp_leafname,du.tp_version
weitere Sql Queries auf die Sharepoint Content Db
Windows7 Aktivierungsfehler / Activation
einfach denselben Productkey nochmals eingeben (Systemsteuerung / System / Windows aktivieren ganz unten)
renter the same product key (system / activate windows)
renter the same product key (system / activate windows)
Windows 7 Ruhezustand
In Energioptionen, Erweiterte Eiunstellungen, Energiesparen, Hybridmodus zulassen "Nein"
Macros for Build Commands and Properties
Im Visual Studio, Projekteigenschaften, Build Events sind folgende Markeos nützlich (Variablen für diverse Pfade, Directories und Files):
Macros for Build Commands and Properties
z.b. $(ProjectDir) $(SolutionDir)
leider lassen sich diese nicht im Working Directory unter Debug verwenden ...
Monday, July 30, 2012
The name 'components' is already used by another object
Windows Forms Designer Fehlermeldung:
The name 'components' is already used by another object
Ursache: doppelte Zeile
this.components = new System.ComponentModel.Container();
in
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.components = new System.ComponentModel.Container();
einfach löschen dann gehts wieder
Sunday, July 22, 2012
windows form textbox.text threadsicher setzten
/// used To set Text Box Threadsave (Invoked by this MoneyManagerForm)
///
/// Textbox to set text
/// text is set to Textbox
private delegate void DelegateSetTbText(TextBox tb, string s);
/// threadsave set of Text of Textbox
///
/// Text of this Textbox is set
/// new text for textbox
private void SetText(TextBox tb, string text)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.InvokeRequired)
{
DelegateSetTbText d = new DelegateSetTbText(SetText);
this.Invoke(d, new object[] { tb, text });
}
else
{
tb.Text = text;
tb.Enabled = true;
}
}
Monday, July 16, 2012
Fehler HRESULT 0x8007052E
Bei Reporting Services trat nach Passwortänderung des WindowsDienst- und Execution Kontos folgender Fehler auf:
Fehler bei der Berichtsverarbeitung. (rsProcessingAborted)
Der Berichtsserver-Windows-Dienst 'ReportServer' wird nicht ausgeführt. Dieser Dienst muss ausgeführt werden, damit der Berichtsserver verwendet werden kann. (rsReportServerServiceUnavailable)
=> Aktualisierung des Paswortes des WIndows Dienst SqlServer Reporting Services und start des Dienstes hatte zum Erfolg, dass der Reportmanager wieder bedienbar war (Navigation durch die Ordner, Eigenschaften von Berichten änderun usw. ging wieder) aber beim Ausführen des Reports trat folgender Fehler auf:
Fehler bei der Anmeldung. (rsLogonFailed)
Anmeldung fehlgeschlagen: unbekannter Benutzername oder falsches Kennwort. (Ausnahme von HRESULT: 0x8007052E)
dieser konnte durch aktualisierung mit dem neuen Passwort im Konfigurationmanager unter Ausführungskonto (ganz unten links) behoben werden
Subscribe to:
Posts (Atom)