Oracle is a spontaneous, divine spellcasting class. She has a greater number of spells per day than a Cleric, and can cast without preparing in advance; but, she has a narrower list of spells that she can choose from. She is the divine equivalent of a Sorcerer (whereas a Cleric is comparable to a divine Wizard).
Be mindful that Oracle isn't especially tuned for making ranged attacks (though she isn't terrible); as you level up, if you find that ranged attacks are your focus more than spells, you may want to consider multi-classing into a prestige class that gives you a higher Base Attack Bonus while continuing your spell progression (Eldritch Knight is a good example). On the other hand, you may decide that you want the Oracle's neat higher-level class abilities (Revelations, etc) more than you want a couple points of extra attack bonus.
Abilities:
Key ability: Cha.
Your key Ability score is Charisma, since Cha gives your spells a higher save DC, limits the highest level of spells you can cast, and grants you bonus spells per day.
For ranged combat, you also need a high Dex. Dex also improves your ability to dodge attacks, and increases your Reflex save (resist fireballs, traps, etc).
Con gets you more hit points, and a higher Fortitude save (resist poison, being turned to stone, etc).
Str won't be very important to your character, except to carry gear.
Int grants you more skill points.
Wis gives you a higher Will save (resist mind-affecting spells, etc).
Skills:
Look through the class skills to figure out what interests you. You should have max ranks in the Spellcraft skill. You can also choose cross-class skills without a big penalty in Pathfinder, so you should skim through the entire skill list to see what's available.
As a rule of thumb, I usually pick a number of skills equal to the number of skill ranks I get per level. For example, if you get 8 skill points per level, you could put max ranks in 8 different skills. If you decide you want more skills than that, you can split up one "ranked skill" into two "half-ranked" skills, and put a half-point in each every level. This isn't a hard-and-fast rule, just a way that I've found of making the decisions and the math much easier.
Feats:
The Extra Revelation feat is an Oracle-specific feat lets you choose an additional optional ability from the list for your chosen Mystery.
Since your character is heavily involved with ghosts, I think the Ectoplasmic Spell metamagic feat from Advanced Players' Guide would be appropriate.
Beyond that, feats which enhance your spellcasting will be the most effective for your character; since you are doing ranged combat, you will have to split your feats between ranged and spellcasting. I would recommend reading through the table at the beginning of the Feats chapter (both in the core rulebook and the Advanced Players' Guide) to get a brief description of what each feat does; there are a lot to choose from.
If your group is more familiar with 3.5 than with Pathfinder, remind them that you get a feat every 2 levels, not every 3 (so you should have 3 character-level feats at level 5).
Build him by feel
SevenSidedDie has an excellent answer about why there's no definitive Gandalf build, but I think we can talk constructively about how to go creating a Gandalf build.
You want to "recreate Gandalf from the books" "in D&D3.5 terms." You can't, not precisely. D&D isn't a good fit at all for actually recreating LotR scenarios or characters: it has a different mythos, a different philosophy toward magic, and is built with mechanical considerations that Tolkien didn't have to worry about.
But we can create D&D characters who are like LotR characters. This is going to require choosing what to keep or emphasize, and what isn't as important so it can be left behind or diminished. We won't be making a character who can accomplish exactly what Gandalf could accomplish --no more, no less-- in the novels. We'll be making a Gandalf who is Gandalf in essence rather than in detail.
What defines Gandalf to you?
Because of the limitations of D&D build options, you'll have to focus on one particular "kind" of Gandalf. Deciding what kind of Gandalf you want to design needs to be deliberate and purposeful, and you'll need to own that decision.
If you were asked to describe Gandalf in a phrase of five words or less, what would you say? If he's an "ancient, angelic guardian of hope," you're going to build him differently than if he's a "crafty and manipulative magical hobo." Both are absolutely true descriptions of him, but each emphasize a different element of his character.
What does this say about race and/or templates?
Gandalf could be a human, an aasimar, a half-celestial, or a number of other choices depending on what kind of Gandalf you've chosen to make. Don't be concerned about whether it's an accurate representation of a Maia clothed in mortal flesh; get the race or template that best reflects the phrase that describes your personal Gandalf.
What does this say about how he gets things done?
What are your Gandalf's goals and how does he accomplish them? Does he ride a white horse at dawn to bring hope to the hopeless, or does he throw flaming pinecones at wolves? Is he a self-sacrificial hero or a guy who pranks his friends by throwing a party at their house without telling them?
The answers to this question will tell you a lot about his class and build. I think of Gandalf as a guy who gets other people to do things, but can handle himself in a pinch, so I consider him a bard.
Don't be afraid to go off canon
If your Gandalf is a powerful spellcaster, forget trying to map his powers in the books to D&D spells. Make him a powerful spellcaster by D&D standards, so he is deserving of the proper eldritch respect.
This is the essence of my advice: Don't try to recreate what Gandalf can do. Recreate the essence of who he is and what he means. At the end of the day we don't remember him as the level 5 human wizard who cast shatter on a bridge; we remember him as the man who sacrificed himself to a terrible monster so his friends could get away.
Best Answer
Well I thought someone was going to propose a build with the classes i've exposed. That didn't happen, but heres what I've been collecting, and my idea:
The data:
Table 6–9: Kobold Fighter Racial Substitution Levels
lvl bab f r w Special
1st +1 +2 +0 +0 Spear focus, Dodge
2nd +2 +3 +0 +0 Constitution boost (Con +2)
4th +4 +4 +1 +1 Strength boost (Str +2)
Kobold Paragon (rotd)
Now my idea:
Sorcerer 1(+2 paragon)(+1 rite)(+2 Loredrake)/ Paragon 3/ Warrior 4/ SoulEater 2/ Haply Warrior 5
CL: 6
BaB: 2+4+2+4 = 12/7/2
TSBase:FRV=(002+133+411+333+144)= 9-11-13
Race: Earth Kobold(-2 Str, +2 Dex, -2 Con)
Warrior Replace: +2 Str, +2 Con)
Great Wyrm Add (+3 Int, +3 Wis, +3 Cha)
Paragon Add (+2 Cha)
Characteristics:
Str+0 Dex+2 Con+0 Int+3 Wis+3 Cha+5
Feats: Dragonwrought, Alertness, Weapon Focus(Claw), Draconic reservoir
So, this way I would be using Soul Eater (BoVD) abilities as "luck stealing" in a necromantic kind of way
Still don't know how to resolve the "unluck aura" though...