Friday, January 28, 2011

Copy schema and data changes from one SQL Server DB to another

Hello Experts,

Can someone please advise me on the below.

I have 2 databases, both of then were identical until few years back when we started to add more tables, procedures, views triggers etc to one of the database. Now i have to copy all the changes made in database 1 to database 2.

Please, can someone throw some pointers or links which can guide me to accomplish the above

Massive thanks in advance

Cheers Amit

DNS setting to redirect abc.example.com properly?

I have two dedicated servers running Apache on RHEL5/CentOS.

The first is setup to be a name server for the domain 'www.example.com'

I need to set it up so that http://abc.example.com points to the second server. What command should I use or what file should I edit?

I think I have to set the 'A' record, but where do I do this in a redhat linux system?

  • You say The first is setup to be a name server for the domain 'www.example.com'. I'm hoping you mean it's setup for the domain example.com, with a host (A) record called www. If not, you already have problems.

    Assuming the domain is example.com, you need a CNAME (alias) record for ABC, pointing at XYZ.example.com.

  • Do both servers have static IP's? If so, the abc should be an A record on the name server pointing to the IP address of the second server.

    From
  • I was mistaken in my assumptions. Neither of the servers had name servers. The domain name was registered at GoDaddy and we added the two IP addresses as 'A' DNS records.

    From matt_tm

Which is the default TCP connect timeout in Windows?

Which is the default TCP connect timeout in Windows? There is a registry key to configure it or it's set dynamically?

  • In Windows the value is dynamic for established conections, though the default for initial connections is 72 seconds. The Registry settings are defined in this article:

    http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx

    HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip \Parameters

    TcpInitialRTT: Defines what the initial time-out settings are for new connections. This number in seconds is doubled each time it retransmits before timing a connection out. Defaults to 3.

    TcpMaxConnectRetransmissions: Defines the number of retransmissions before timing a connection out. Defaults to 5.

Two way, multi-site replication in MySQL

We have MySQL 5.1 databases at 5 separate locations that we need to keep as synced as possible. Each office needs to read/write from/to the local server at that office, but I need the DB at each office to reflect changes made at all offices. Changes to data are made only during typical 9-5ish office hours, and WAN speeds are slow (1-5 Mbps).

I'm not able to have writes from all sites go to a single master, and my understanding from the docs and from other Qs&As here is that master-master replication is not appropriate for this kind of situation and would likely result in lost data.

Here's the approach I'm leaning towards taking:

  • set up triggers to audit inserts, updates (only changed fields), and deletes, and write these to 1 location at the end of the day.

  • a job runs nightly at each office that downloads the entire audit log for all offices, and writes the most recent changes based on the audit trail timestamp -- this is a simplistic approach, but we don't have many constraints to worry about and the app using the data creates GUIDs for new records so no auto-increment worries.

Is there a better way than this manual approach, or is there a better way to do it manually? Am I missing something regarding multi-master replication? This is far from ideal, but it at least gets us synced for the start of every day. I would welcome any suggestions.

Thanks.

  • If you're going with this approach, a potential tradeoff for speed could be using flags for new and dirty records (new could be default for INSERTed rows, dirty could be set by trigger on UPDATE) but depends on the workflow and auditing requirements. Rather than replicating all of the repeated changes to a record over the day, only the final value would be updated on all of the other systems and then the flag would be cleared. You'd still need a table for deletes (unless you want to go with the ever-so-popular "deleted_on" timestamp and likely change all of your code). If records don't change much once written you won't get a lot out of it.

    This would require that the server be up at the end of the day, though. With an audit table, you could write the audit table to a file somewhere else periodically (rather than just at the end of the day) in the event of DB failure.

    nedm : This would streamline things a bit. The application code is not under my control, so I'd have to either use an index table or add fields and create views that only feed the original fields back to the app.
    From DerfK
  • Galera is a synchronous multi-master solution that you might want to look into. I don't really know much about it myself and consider it esoteric but it might be something you want to look at more closely.

    Cheers

    From Jason
  • removed since there is an upvoted answer

    From karmawhore

Self Hosted Dropbox Alternative?

Does anyone know of any self-hosted Dropbox alternatives?

We have a need to share files/folders between staff and partners (small scale) and for various reasons we'd prefer to host it ourselves.

Sharepoint seems a little too focussed on "check in/check out" and things like webdav/ftp seem a little kludgy.

In an ideal world something where you (as an IT person) can setup an area, make a user "owner" and from there they can add their customers would be great.

Windows or Virtual Appliance would be ideal.

Thanks.

  • The people behind MyNetworkFolders offer such solutions for those who prefer something self-hosted.

    From adamo
  • Zendto

    "This is a web-based package that will let you provide a secure and easy-to-use method for your users to be able to exchange files with other people, even with people on other sites that do not have any login rights at your site. Unlike other commercial services, you do not have to trust your files or login rights to any other services; you run all of it yourself. It integrates with your existing authentication system if you have one, or else it can use its own secure SQL-based user authentication system. It will integrate with any Active Directory, LDAP or IMAP system you already have in place. It was originally based on the "Dropbox" package written by the University of Delaware."

    From Linker3000
  • http://www.sparkleshare.org/

    I haven't tried it though.

    From Lamnk

Syslog not logging anything; /var/log/syslog is empty

Recently sendmail stopped accepting messages for delivery on my Solaris 10 x86 machine. I am trying to diagnose the problem but syslog doesn't seem to be working either. My /etc/syslog.conf:

#ident  "@(#)syslog.conf        1.5     98/12/14 SMI"   /* SunOS 5.0 */
#
# Copyright (c) 1991-1998 by Sun Microsystems, Inc.
# All rights reserved.
#
# syslog configuration file.
#
# This file is processed by m4 so be careful to quote (`') names
# that match m4 reserved words.  Also, within ifdef's, arguments
# containing commas must be quoted.
#
*.err;kern.notice;auth.notice                   /dev/sysmsg
*.err;kern.debug;daemon.notice;mail.crit        /var/adm/messages

*.alert;kern.err;daemon.err                     operator
*.alert                                         root

*.emerg                                         *

# if a non-loghost machine chooses to have authentication messages
# sent to the loghost machine, un-comment out the following line:
#auth.notice                    ifdef(`LOGHOST', /var/log/authlog, @loghost)
auth.info               /var/log/authlog

mail.info               /var/log/maillog


#
# non-loghost machines will use the following lines to cause "user"
# log messages to be logged locally.
#
ifdef(`LOGHOST', ,
user.err                                        /dev/sysmsg
user.err                                        /var/adm/messages
user.alert                                      `root, operator'
local7.debug                                    /var/log/mimedefang
user.emerg                                      *
)

/var/log/authlog works. So does /var/log/mimedefang and /var/adm/messages. However, /var/log/syslog is empty and the last line in /var/log/syslog.0 is from over a month ago. /var/log/maillog is also empty. I have restarted system-log and sendmail multiple times using svcadm. Is there something wrong with my syslog.conf?

  • My /etc/syslog.conf (andLinux) contains

    *.*;auth,authpriv.none          -/var/log/syslog
    

    The one you posted doesn't mention /var/log/syslog.

    RedGrittyBrick : I'd wait for MadHatter to post an answer and accept that.
  • As @MadHatter states above, syslog.conf does not mention /var/log/syslog anywhere. Therefore, no logs will be written to /var/log/syslog.

    If I remember right, most Solaris systems had a line which looks like this in syslog.conf:

    mail.info                     ifdef(`LOGHOST', /var/log/syslog, @loghost)
    

    OR

    mail.debug                      ifdef(`LOGHOST', /var/log/syslog, @loghost)
    

    OR

    mail.info                     /var/log/syslog
    

will yum update delete all my databases? settings? etc.

I just hosed my Centos install and I'm wondering whether to do a yum update? I have loads of mysql and solr databases that I am working on. Will it delete those? Should I do a backup before doing a yum update?

  • Yes making a backup is ALWAYS the right answer.

    No using package managers like yum to upgrade your system will not mess with your data.

    The only caveat is that sometimes data formats change between versions of software. For example the data storage format mysql uses might change, and the upgrade scripts might help you convert your data to the new system, but it is very unlikely that a package upgrade like this will actually break your data. Also backups are the right thing to do because if anything goes wrong with system updates such as an unbootable system on a kernel upgrade, that backup will be nice to have in your pocket.

    From Caleb
  • First, you should always be doing backups. Irrespective of performing any updates, performing backups are simply a requirement for sysadmins.

    It's not clear what you mean by "hosed my Centos install", so it's tough to say if any yum operations would be helpful. But in genreal, no, yum update will not delete existing databases.

    Ke : thx :), by "hosed" i mean that I uninstalled alsa on centos and it deleted like every package from centos. Will doing a yum update help?
    jscott : @Ke `yum update` probably won't fix it. You should try to re-install alsa and, hopefully, any dependencies, with something like `yum install alsa alsa-drivers`. Failing that, perform a clean install and restore your data from backup.
    From jscott
  • It depends on the quality of the package. If the package is written sanely then it will not affect your data in any way. Almost all first-party packages are sane.

  • Never do anything you're unsure of out of desperation. Always have a backup even if you think you know what will happen.