This week, after refactoring some XML based Java classes, I was left with ~50 XML documents (used for testing) with the wrong root element. After a few seconds pondering opening a text editor and find/replacing 50 times I had a better idea: sed. sed can be used to perform regular expressions on each line of a file (or files). To solve the problem all it took was: sed -i s/oldroot/newroot/ * -i: edits the files in place instead of printing to stdout All 50 documents updated, simple as that.
This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.
I’m not a person to write long texts or poetry. I am not the person to share you my most inner feeling. I am not the person that talks much. I am not the person to take the first steps. I am not the person that is always happy and cheerful. I am not the person who wants to be liked and admired. I am not the person that want to be in the spotlight. I am not the person you think I am. I am not all that and I will never pretend to be. I am the person that will tell you what I think. I am the person that wants to do the best he can. I am the person that tries his best all the time. I am the person that is me and no one is going to change me because I am the sum of all my parts.
Introduction My techdays 2011 (Belgian edition) started on Monday evening with a small dinner with Scott Hanselman, Glenn Block, Hadi Hariri, Maarten Balliauw, Yves Goeleven and Katrien De Graeve. It was great to meet this people, most for the first time. And Scott looked even worse than usual, respect man, travelling across the world to speak to people you do not know when you are in pain and just lost your voice, respect. Of course it did not stop him from talking, and you can get a feel of how difficult it is to get in a word with these guys if you listen to the latest Hanselminutes.
Having to make a decision between 32 bit and 64 bit servers is becoming less common. 64 bit servers are the predominant platform when purchasing hardware. With that said, existing hardware still varies greatly between the two platforms. Purchasing new hardware When purchasing new hardware, it will be difficult to find hardware that is only 32 bit. Although 64 bit hardware is an accepted, better choice for scalability, primarily in regards to memory, 32 bit platforms are still wanted for certain situations. Luckily, you can purchase 64 bit hardware and install a 32 bit operating system on that platform. This is a major benefit in regards to applications that may, for some unknown reason, not support 64 bit operating systems.
The Model database is used as a template for all user databases that are created in SQL Server. This means the options, tables, routines and many other objects and settings that are in Model, will be in new user databases. Knowing that Model is utilized for this task can be useful by taking advantage of it by changing Model to match the best practices that fit your SQL Servers. To see a full list of database options that can be changed and flow to new user databases, read Model Database.
One of the tricks I picked up from my last job (and our forum software, now that I think of it) is the idea of user emulation. I could log into the application, search for a user, and, at the push of a button, temporarily become that user. The only differences between emulating them and actually logging in as them were a black bar that indicated who I am (with a link to stop emulating), all audit records continued to reflect my own user id, and I didn’t need to keep track of 30 different sample accounts and passwords.
The second SQL Server DBA Tip is going to cover placing data files. There are a few primary concerns when deciding where to place data and log files. System Databases, I/O Overall Performance and Space Considerations will be the focus today. Storage comes in many forms and configurations. With Solid State Disk coming into the mix with Hard Disk Drives, a new avenue is paved in performance measurements. SSD comes with an extremely high price tag and this has kept it from truly taking a hold in all data centers. As demand goes up and manufacturing increases, price will undoubtedly come down. Until then, making HDD work as optimally as possible is still a major factor.
For the first post in the SQL Server DBA Tip of the day series, MAX Memory configuration is the topic. Let’s get right to it… SQL Server Maximum Memory configuration is a value specified to limit how much memory the buffer pool can have. The Buffer Pool consists of dirty and clean pages that SQL Server has used. The entire contents of the pool can be seen with the DMV sys.dm_os_buffer_descriptors and you can see the state of a page using the is_modified field. This can be seen in great detail in a post by Paul Randal, “Inside the Storage Engine: What’s in the buffer pool?” The page count per database in Paul’s post is extremely useful for an overview of the area that the pool is being used for most in terms of databases.
I once had a boss whose desk looked something like this: Shudder. I like things organized, from the files on my desk to the files in my database. There’s a mechanism in SQL Server to help you separate and organize files: filegroups. What is a Filegroup? A filegroup is a logical structure to group objects in a database. Don’t confuse filegroups with actual files (.mdf, .ddf, .ndf, .ldf, etc.). You can have multiple filegroups per database. One filegroup will be the primary, and all system tables are stored on it. Then, you add additional filegroups. You can specify one filegroup as the default, and objects not specifically assigned to a filegroup will exist in the default. In a filegroup, you can have multiple files.
Interested in finding out where your iPhone has been? How about importing that data into SQL Server and being able to analyze it and create maps from the spatial data? If you have an iPhone and/or follow any of the security news about it, you may have seen multiple posts recently stating that Apple is tracking everywhere your iPhone goes even when you have location services turned off. There’s even an open source application called iPhoneTracker that will create a map for you. I’m not going to debate the good, bad, and why’s of this “feature”, but what I will do is show you how you can find this data, import into SQL Server, and some things you can do with it.