If you live in a seismic area, it's important to anchor all your standing shelves to the wall to keep them from tipping over. This is especially true for bookcases -- they're tall, unstable and particularly dangerous because of the weight of the books they hold. Furniture safety straps provide security without the need for drilling into the bookcase, but if the bookcase is too heavy to move, you have to settle for metal corner brackets.
You can stabilize any shelf unit against a solid wall by securing it with corner brackets, but these require you to drill a hole in the side of the unit or underneath one of the shelves. Furniture safety straps eliminate the need to drill any holes -- instead, you secure the strap to the wall, glue a piece of Velcro to the shelf unit and press the strap onto the Velcro strip. A third option is to secure the shelf to the wall with metal strapping. Like corner brackets, metal strapping calls for holes in the bookshelf. If you want to avoid holes in the wall altogether, insert shims under the front feet of the bookcase to make the unit tilt slightly backward.
Find the Studs
Securing things to the wall by screwing into a stud is safer than using a wall anchor in the drywall where there's no stud, and this especially true for a heavy bookcase. The most reliable way to find studs is to use an electronic stud finder; turn the device on; run it along the wall, and mark the places where the light goes on or the meter signals the presence of a stud. In modern houses, studs have a standard separation of 16 inches, so locate one and you can find the others with a tape measure. The spacing may vary if you have plaster walls; in that case, find each stud separately.
Attaching Furniture Braces
You'll have to move the bookcase out of the way to attach furniture straps -- they go behind the bookcase, placed high enough on the wall to reach the top of the shelf unit. Screw each one to a stud with a single screw or lag bolt -- use a washer to distribute the outward force over as much of the strap as possible. Glue the Velcro strips the top of the bookcase, and then move the unit back into place and connect the strapping to the Velcro. You can use strapping on a concrete or brick wall by drilling a hole with a masonry bit, installing a masonry anchor and driving the screw into the anchor.
Using Metal Braces
Whether you use rigid metal corner brackets or metal strapping, be sure the material is beefy enough to hold the shelf unit; in general, the bracing material should be at least an inch wide. You don't need to move the bookcase -- simply clear one of the top shelves; locate the studs behind the shelf unit, and screw the bracing material to the top or underside of a shelf or to the side of the unit in front of each stud. Drive a 3-inch screw into each brace to secure it to the stud. If the unit has a backing piece, cut holes for the braces with a jigsaw.