05.20.08
Posted in Debian, Linux at 11:08 pm by Hedwig Lodrigo
This is in now way the definitive guide to getting ssl to work on your host. This is what worked for me.
First you need to get openssl
apt-get install openssl ssl-cert
Generate a self signed cert. This will protect your traffic however it will give warning in the browser of the user.
If you don’t want these warnings you will have to get a cert from a trusted certificate authority.
openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
It will ask some questions, you can fill in what you want on most of them, however
Common Name (eg, YOUR name) []: *.yoursite.com
Make sure you give the name of your top level domain there.
Give the pem file the right permissions:
chmod 600 /etc/apache2/apache.pem
You want the server to listen on the ssl port, so you change /etc/apache2/ports.conf to
Listen 80
Listen 443
You add the Listen 443 line.
Now you want have to edit the default file
vi /etc/apache2/sites-available/default
Change
NameVirtualHost *
To
NameVirtualHost *:80
NameVirtualHost *:443
I looked long for this part, for some reason I have to add this to my default file, else ssl doesn’t work on my
other virtual hosts.
SSLCertificateFile /etc/apache2/apache.pem
SSLEngine On
Then you have to
add
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
to the definition of your host which you want to run with ssl.
sample:
ServerName sample.com
#other directives
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
SSLCertificateKeyFile /etc/apache2/apache.pem
/etc/init.d/apache2 restart
That’s it.
Permalink
05.18.08
Posted in Debian, Linux, Miscellaneous, windows at 3:53 pm by Hedwig Lodrigo
GIT Version system
Git is a distributed file versioning system. It was initially created by Linus Torvalds. Linus is better known for the creation of linux.
This is some quick guide on getting started with GIT for people with a windows desktop and a linux server.
Download the windows GUI version of git from http://code.google.com/p/msysgit/downloads/list
Install it.
To create a new repository, only needed if you are starting a new project. If you are going to contribute to a existing project skip to the next section
Open a command line. navigate to the place where you want to start a new repository. Create a new directory for the repo.
sample:
md init_repo
cd init_repo
git init
cd ..
git clone –bare init_repo repo.git
Now upload the repo.git directory to your webserver. I do this with winscp, but you can use whatever way you like.
SSH into your server. Install git
example:
apt-get install git-core
To get a existing git repo.
Open a command line.
Navigate to the directory where you want to have the repo.
git clone ssh://username@host.com/path_to_git_repo
I’m using ssh instead of the daemon as I don’t really see an option to password protect the repo.
Permalink
04.01.08
Posted in Linux, Miscellaneous at 12:13 pm by Hedwig Lodrigo
Use this command
find . -name .svn -print0 | xargs -0 rm -rf
You could also use “svn export”…
Permalink
03.31.08
Posted in Miscellaneous, windows at 4:28 pm by Hedwig Lodrigo
You can check the current time on your domain by typing in the following
net time
This gives me: Current time at \\s-dc1.mydomain.local is 3/31/2008 1:56 PM
To setup Time synchroniziation type in:
>net time /SETSNTP:\\s-dc1.mydomain.local
s-dc1.mydomain.local Local should be replaced with the servername where your time service is running. Now to check check what time server your pc uses type:
net time /QUERYSNTP
Voila.
Permalink
Posted in Miscellaneous, windows at 3:38 pm by Hedwig Lodrigo
IIS 6 has by default parent paths disallowed. These settings are required to use relative paths in virtual includes.
Parent paths allow you to use ‘..’ when browsing directories and MapPaths etc enabling files in the parent directory to be used.
To enable parent paths:
• Start the Internet Services Manager (Start - Programs - Administrative Tools - Internet Services Manager)
• Right click on the web site and select properties
• Select the ‘Home Directory’ tab
• Click the ‘Configuration’ button under the Application Settings
• Select the ‘App Options’ tab
• Check the ‘Enable parent paths’ box and click Apply
You don’t need to restart the service for the change to take effect.
Permalink
03.25.08
Posted in DBA, Microsoft Sql server, TSQL at 12:20 pm by Hedwig Lodrigo
After a domain migration you might find yourself in a position where you have a whole bunch of jobs with dead domain accounts. Then you could use sql server management studio to update the job ownership one by one. Or you could make a script which updates it for you. The next script gives you a the basics to script this. Just change the OLD_ACCOUNT by the account you want to replace and the NEW_ACCOUNT by the account you want to replace it with.
SELECT ‘EXEC MSDB.dbo.sp_update_job ‘ + char(13) +
‘@job_name = ‘ + char(39) + j.[Name] + char(39) + ‘,’ + char(13) +
‘@owner_login_name = ‘ + char(39) + ‘NEW_ACCOUNT’ + char(39) + char(13) + char(13)
FROM MSDB.dbo.sysjobs j
INNER JOIN Master.dbo.syslogins l
ON j.owner_sid = l.sid
WHERE l.[name] = ‘OLD_ACCOUNT’
ORDER BY j.[name]
The output of this script should copy paste and run in the sql server management console.
Permalink
10.12.07
Posted in DBA, Microsoft Sql server, TSQL at 11:41 am by Hedwig Lodrigo
When you have to delete a whole bunch of records from a table which has to stay in use. Then you could do it with a cursor. but you can also do it with the following approach. Use top to limit the amount of records deleted and put the deletion in a loop.
Sample code:
DECLARE @p as int;
DELETE [dbo].[Klanthistoriek]
FROM (SELECT TOP 50000 klh_id
FROM
[GKA].[dbo].[Klanthistoriek]
WHERE
KLH_CreatieDatum between ‘2007-09-18 10:47:40.820′ and ‘2007-09-20 15:29:32.663′ ) as temptable
Where [dbo].[Klanthistoriek].klh_id = temptable.klh_id;
SET @p= @@rowcount;
WHILE @p <> 0
BEGIN
DELETE [dbo].[Klanthistoriek]
FROM (SELECT TOP 50000 klh_id
FROM
[GKA].[dbo].[Klanthistoriek]
WHERE
KLH_CreatieDatum between ‘2007-09-18 10:47:40.820′ and ‘2007-09-20 15:29:32.663′ ) as temptable
Where [dbo].[Klanthistoriek].klh_id = temptable.klh_id;
SET @p = @@rowcount;
PRINT @p;
END
Permalink
Posted in DBA, Microsoft Sql server, TSQL at 11:36 am by Hedwig Lodrigo
You removed a maintenance plan and it didn’t delete the job. You got the following error:
The DELETE statement conflicted with the REFERENCE constraint “FK_subplan_job_id”. The conflict occurred in database “msdb”, table “dbo.sysmaintplan_subplans”, column ‘job_id’.
The statement has been terminated. (.Net SqlClient Data Provider)
You can remove the job by executing the following code:
– Set @job_name to the job name you want to delete
USE [msdb]
DECLARE @job_name varchar(100)
SET @job_name = ‘job name’
–Delete the logs for the plan
DELETE
sysmaintplan_log
FROM
sysmaintplan_subplans AS subplans
INNER JOIN sysjobs_view AS syjobs ON
subplans.job_id = syjobs.job_id
INNER JOIN sysmaintplan_log ON
subplans.subplan_id = sysmaintplan_log.subplan_id
WHERE
syjobs.name = @job_name;
–Delete the subplan
DELETE
sysmaintplan_subplans
FROM
sysmaintplan_subplans AS subplans
INNER JOIN sysjobs_view AS syjobs ON
subplans.job_id = syjobs.job_id
WHERE
syjobs.name = @job_name;
–delete the job
DELETE FROM
msdb.dbo.sysjobs_view
WHERE
name = @job_name;
Permalink
Posted in DBA, Microsoft Sql server, TSQL at 10:55 am by Hedwig Lodrigo
When using the Bulk-Logged recovery model your server logs the bulk commands minimally, our so you think. For sql server to log minimally other criteria should be met!
First off the table should not be replicated. And when you do your bulk logged command you also need to lock the table.
SAMPLE
sp_tableoption target_table, 'table lock on bulk load', 1
INSERT INTO target_table
(a,
b
)
SELECT
a,
b
FROM
source_table
sp_tableoption target_table, 'table lock on bulk load', 0
Permalink
10.11.07
Posted in DBA, Microsoft Sql server, TSQL at 5:24 pm by Hedwig Lodrigo
Your transaction log is huge and has free space.
So you want to shrink it and it shrinks very little. You can solve this by running following script.
USE your_db
GO
DBCC SHRINKFILE(your_log, 200)
BACKUP LOG your_db WITH TRUNCATE_ONLY
DBCC SHRINKFILE(your_log, 200)
WATCH OUT
The TRUNCATE_ONLY which we use and the NO_LOG options of the BACKUP LOG statement will be removed in a future version of SQL Server. These options remove the inactive part of the log without making a backup copy of it, and truncate the log by discarding all but the active log. This breaks the log chain. Until the next full or differential database backup, the
database is not protected from media failure. Therefore, we strongly recommend that you avoid using either of these options in new development work and that you plan to modify applications that currently use it.
Your transaction log is huge and has no free space.
First we need to find out why it’s in use.
SELECT
name,
log_reuse_wait,
log_reuse_wait_desc
FROM
sys.databases;
Read Factors That Can Delay Log Truncation, this page explains the result.
Permalink
« Previous entries