Michael's profile阿沙不路PhotosBlogListsMore ![]() | Help |
|
July 18 英語的真正說法英語的真正說法(ZZ) 英語的真正說法 英語的"大便、小便、放屁"真正說法 一名中國留學生初到美國,在機場找廁所,問老外:「Where is W.C.?」老外聽不懂。一名中國太太到醫院生產,洋護士問她:「Did you have a bowel movement?」她卻聽不懂。還有人學了幾十年的英語,還不曉得英語裏的「大便」、「小便」、「放屁」真正應該怎麼說...... 至於性毛病,更是老中難於啟齒、欲語還羞的尷尬。見到洋醫生,窘迫萬分,不知如何開口才是,真有「猶抱琵琶半遮面」的感受。 以下為一些「禁忌」(taboo)的美語之整理。畢竟這些都是咱們日常生活的一部分,說不定有一天這些「禁忌」之語還能「派上用場」呢! 廁所 在美國一般都叫rest room或bath room(男女廁均可)或分別叫做 men's room 或 ladies' room(= powder room),不過在飛機上,則叫 lavatory,在軍中又叫 latrine。至於 W.C.(water closet)仍是過去英國人用的,在美國,幾乎沒有人使用。 解小便 最普通的說法是 to urinate(名詞是 urination),如果去看病,護士為了化驗小便,就會給你一個杯子說:「Will (could) you urinate in this cup?」醫生或許也會問:「Do you have trouble urinating?」=Do you have difficulty voiding?(小便有困難嗎?) 此外,還有其他的說法:to piss = to take a piss = to take a leak = to void = to empty。 例如: I need to piss = I have to take a leak. How often do you get up at night to void?(晚上起床小便幾次?) 此外,john(j 小寫時,不是男人名字)是 bath room 或 toilet 的意思(也叫 outhouse),這通常是指在戶外工作場地所使用的臨時或流動性廁所(有時前面也加 portable 一字)。不過也有老外把家裏的廁所叫做 john。 例如: There are several (portable) johns in the construction site.(在建築場地有幾個臨時廁所。) He went to the john a few minutes ago.(他在幾分鐘前上了廁所。) The manual labours have to use (portable) johns during their working hours.(勞動者在工作時間內需要使用流動性廁所。) 不過,小孩多半用 to pee 。例如: The boy needs to pee. 然而,「小便檢查」又叫做 urine test,因為這裏的 urine 是化驗的樣品(specimen)。 例如: Do I need a urine test? 注意:to piss off 是片語,又是指對人生氣或對事物的不滿。不過這是不禮貌的片語,少用為妙。 例如: He pissed me off. = He made me angry. He always pisses off (at) the society.(對社會不滿) 如果「小便」有毛病,也可以告訴醫生說: My urine is cloudy and it smells strong.(有濁尿,味道很重) I have pus (或air)in urine.(尿有泡沫) (pus = cloudy; air = bubble) I dribble a little urine after I have finished urinating.(小便後還會滴滴答答。)(即失禁毛病) I am passing less urine than usual.(小便的量比平時少) 解大便 一般是用 to make(或 have)a bowel movement 或 to take a shit。如果看病,醫生常問:「Do you have regular bowel movement?」(大便正常嗎?)(說得斯文些,就是「大腸在轉動」) 此外,還有其他的說法: to defecate =to discharge excrement(或 feces)=to take feces (或 faeces)。 例如: The patient needs to take a shit. (=to make a bowel movement) 不過,小孩多半是用 to make a poo poo 或 to make a BM. 。 例如: The boy had a stinky BM.(大便奇臭。) 但是「大便檢查」倒叫做 stool exam,因為 stool 也是一種化驗的樣品。 例如: The doctor has to exam his stool.(醫生要檢查他的大便。) 放屁 在美語裏最常用的是 to expel gas 或 to fart 或 to make (或 pass)gas。 例如: 醫生有時問:「How often do you expel(或 make 或 pass)gas?」(你放屁的次數很多嗎?) Is the gas expelled by belching?(是否打嗝後就會放屁呢?)(動詞是 belch) He said the more he ate, the more he farted.(吃的愈多,放屁也愈多。) He has passed more gas than usual within the last two days.(過去兩天中,他放屁比平常多。) Be careful not to fart in the public.(注意在公共場所不可放屁。) 至於消化不良,大便不通或拉肚子,也有不同的說法。 例如: I have an upset stomach.(消化不良) = I have heartburn. = I have indigestion. 注意:Heartburn 是指胃不舒服,不是「心痛」(heartache) Something has upset my stomach for two weeks.(胃不舒服有兩星期了。) He has(persistent)constipation.(或 irregularity)(他經常便秘。) 或 He has been unusually constipated.(便秘很反常。)或 He is having problem with irregularity.(或 constipation); 或 He has no bowel movement for the past few days. He has bouts of diarrhea.=He is having trouble with diarrhea.(他拉了一陣肚子。) He can see trace of blood and pus or mucus in his stool(或 bowel movement)(大便時可看到血絲和粘膜。) 常用的一些英語俚語140條 記住千萬不要用在正式場合 1) ace: She is an ace dancer. 就是牛X的意思啊。 2) all-nighter: I felt very tired after an all-nighter. 通宵。 3) beemer: That girl is driving a beemer. BMW, 寶馬。氣人的是,我們停車場裏一輛牛款beemer的主人不是官最大的,當然不是最有學問的,而是一個有錢人的小千金。 4) booze: I'm going to bring a bottle of booze to your party. 酒 5) bummer: 壞事,不好的方面。別人要跟你說開車撞了電線杆子,你就要說 Oh, bummer!一表感同身受。 6) chicken: He is really a chicken. 弱人 7) cool: 港片裏的"酷"啊,用得實在多。 8) cop:That crazy driver was pulled over by a cop. 員警,可不要當面叫啊,當面叫"ShuShu". 9) couch patato: My roommate is a couch patato. 喜歡長時間坐那看電視的懶蛋。 10) deep pockets: I don't want to buy it, it's for people with deep pockets. 富鬼。 11) flip side: Don't watch the flip side, it's too personal. 另一面,反面 12) foxy: Look at that foxy lady! 性感撩人的 13) nuke: That country is working seriously on nukes. 北韓,說你呢。 核彈。 14) pain: That's a pain in the neck. 煩人的, 15) psycho: That psycho scared me. 說人"有病" 16) rock: You wanna your coke on the rocks? 冰塊, 注意介詞 17) shot: Do you wanna another shot? 試試 18) yukky: That dish was yukky. 難吃 19) get it: Did you get that joke? 搞明白 20) glitch: We shut the pc down since there was a glitch. 小毛病,比如以前電腦裏的一些莫名其妙的東西經常搞死機子。 21) goofy: They were worrying about their goofy kids. 傻,不懂事,頑皮 22) grand: Give me two grands and the car will be yours. 一千大洋 23) groovy: His Mom made some groovy art. 有品位的 24) gross: 噁心 25) guts: 膽量 26) vibes: I have bad vibes about that person. 對別人感覺如何的"感覺"。 27) up: He has been up since married. 高興。"七喜"的英文是啥來著? 28) veg: He veg out in front of TV all the time. "菜"在那不動 29) 好吃叫"yummy".鬼子喜歡聽好話,他們要做點啥請你吃你可一定要裝一裝說"yummy". 30) fishy 可疑的。 That sounds fishy. 31) drag 沒勁的事 It's such a drag to deal with them again and again. 32) roll 走,離開。(今天還聽一人說Ready to roll?來著) Are you ready to roll? Let's roll. 33) nuts 瘋 Are you nuts? The trafic drives me nuts. 34) freak out 緊張害怕 Don't freak out if cops pull you over. 35) rip off 騙了(錢了) I realized I was ripped off after payed 0 for these shoes. 36) bug 討厭 Stop bugging me with your plan. I won't do it with you 37) shrink =A psychotherapist 心理醫生 38) airhead =A silly, rather unintelligent person. His girlfriend is an airhead. 39) a-yo 比較隨便的打招呼,近似於"What' up?" "Hey!" 40 buzz 打電話 Give me a buzz when you reach home. 41 bread =money. breadwinner 養家的人 42 booty 屁股 Check out her booty! 43 boob 乳房 44 cheesey 很沒品味,很土=corny The gift I receieved from Ryan is cheesey. 45 cig cigarette的縮寫 You got a cig? 46 crap =nonsense What he said is crap. Don't net a word of it. 47 f-u-c-ked up 可以表達很多意思,比如"糟透了,笨死了" You are pretty f-u-c-ked up. 48 freaky =weird He's a freaky guy.=He is a freak. 49 flick =movie That was a good flick. 50 get on (one's) nerves =to annoy You really get on my nerves. 51 goof 笨蛋 goofy=silly 52 hang out (和朋友)出去消遣 53 hooker 妓女 54 hot 迷人 Man, that girl was hot! She is such a hottie! 55 juicy 桃色八卦的 a juicy scandal 56 jerk 粗蠢之人 57 jerk off =to masturbate 48 jackass "公騾",說人就是"蠢騾"的意思, MTV台就有一檔叫JACKASS的節目,專門表演一些無聊又愚蠢的玩意兒逗樂 49 pimp 拉皮條的 50 puke =vomit There's puke on the floor. 51 pussy =vagina 52 redneck (美國的)鄉巴佬 53 sassy =styling. 時髦的 Those clothes are sassy! 54 nifty 棒,一流的 Here's a list of all-around nifty things that we've found over the years. 55 screw up =err;mess up They screwed up that paint job. 56 [內容被過濾,請注意論壇文明] 討厭,煩人 Final exams [內容被過濾,請注意論壇文明]. 57 twisted = displeasing; MESSED UP That's twisted! twisted mind 奇思異想;怪腦筋 58 meth Methamphetamine的縮寫,即"冰毒" 59 tweaker =a person who uses meth 60 MDMA 搖頭丸,也叫"Ecstasy"/"XTC" 61 pot =Marijuana;joint 大麻煙 62 crack 強效可卡因63 whiz 小便 I just took a whiz. 64 gig =job I just do these gigs as a cover. 65 dump 甩了某人(比如女朋友) 66 get high 爽一下 Do you get high? 67 p-i-s-s off 68 get a crush on somebody 迷上某人 69 thirtyish = thirty something 三十多歲的 70 bent =angry It's OK. Don't get so bent. 71 booze = alcohol He promised to bring two bottles of booze to the party. 72 call =prediction The weatherman made a good call about when the storm would come. 73 chintzy =cheap That really was a chintzy present you got him. 74 cut out =leave It is late. I have to cut out. 75 dope -drug There are a lot of dope dealers around here. 76 freebie 免費品 The pillow was a freebie 77 get it =understand I listened to the joke twice, but I still don't get it. 78 grubby = unclean and untidy Those clothes are too grubby to wear to the party. 79 hairy =dangerous That was a hairy plane trip. I am glad the storm is over. 80 fag 是"faggot"的簡寫, 對同性戀男子的貶稱 81 street smart 知道在城市生活該怎麼處置一些事情,應該如何應付各種不同的情況,比如如何保護自己。 82 chill/chill out =relax 放鬆,休息 Glad class is over! I'm ready to chill for the rest of the morning. I haven't had a chance to chill out these last few days, getting ready for school and all. 83 ditch 做名詞用是指地上的溝; 做動詞to ditch表示要離開某個人,因為你不想跟他在一起了;或表示要馬上離開一個不想再呆的地方。 It's too noisy. Let's ditch this place. 84 hit the spot 感到過癮,覺得很痛快。比如你肚子餓了,吃得心滿意足,就可以說That food really hit the spot. 85 big gun 大人物,對決策有重大影響的人 The company's big gun quarterbacked the meeting about their revenue report. 86 quarterback 本意是美式足球的四分衛,做動詞在可以表示"主持會議,或總管專案" The project leader quarterbacked the meeting. 87 lame 無聊,沒意思,或者不合適的 Don't give me any lame excuses next time I want to do something! 88 shot 是指什麼東西壞了,或者人體的某個部位受傷了 I think my engine is shot. This is not good. 89 damage 是指為某樣東西或某個交易付的錢, 通常用"bad/not bad"來表示價錢高低 The damage for renting the car is pretty bad. 90 choke 糟糕,失敗的意思 I think New York is going to lose. Knowing them, their going to choke. 91 money 保持高水準,非常棒的意思 Yao Ming is money. 92 hard headed =stubborn 頑固,固執 93 drained =exhausted 非常累 You are full of energy. But I'm drained, I'm going to sleep. 94 wired 一 精力充沛. After the next cup of coffee, I think I'm going to be pretty wired. 二 to be connected to something, such as being wired into the Internet, or being wired into a discussion. 95 kick back 休息,和某人一起玩 It's a good time to just kick back and relax. 96 one track mind 意思是腦子裏光想一件事 Geez, you have such a one track mind sometimes. 97 ticked off 為了什麼事情生氣 Crossing the streets in New York and Washington is dangerous. But getting ticked off about it won't do you any good. 98 close call 差一點沒發生的倒楣的事,或是差一點完不成的該做的事 99 goof off (年輕人)一些無聊的事?玩笑 No more goofing off! 100. poop --To defecate 拉屎昨天Fox台the 55th Emmy Awards Ceremony上,就有人說pooped his pants 101. liplock 接吻 Madonna 和 Britney 那個French kiss大家都看見了吧 102. snoozer---something tedious or boring 使人打瞌睡的東西 103. sour-puss-----A habitually gloomy or sullen person 撲克臉 104 toss-up---- even chance 原意為拋硬幣,引申為"對半開的機會" It is a toss-up whether he will win or lose. 105 pratfall---a comedy fall upon one's buttocks 屁蹲兒 105 pick-up line: a prepared opening line of conversation intended to get someone interested in having a causal sexual relationship. 不知道中文裏面又沒有對應的詞,我頭一回聽說這個詞是看Will & Grace, Grace抱回一隻小狗結果Will著了魔,吃飯睡覺都捨不得放下狗狗,Grace明白Will同志是太寂寞了,於是勸他go on a date,Will很不自信,她就鼓勵道 You still have a pick-up line. 106 poofter/pooftah/poufer: (Derogatory) 1. a male homosexual. 2. an effeminate male. --adjective 3. homosexual. 對男同性戀的貶稱,尤其是對sissy的男同,我看過一個澳大利亞電影Head On,裏面一個被激怒的的父親對女裝打扮的兒子就用了這個詞兒。同意詞還有pansy 107 party animal: 1. a person who parties hard. 2. a person who is always going to parties. 派對動物 108 party pooper: a person who has a discouraging or depressing effect, especially at a party. 冷場人物 109, on the money 正正好。比如說,兩條線正好重疊,扔出去的東西擊中目標等。 110, sabbatical 這個不太是俚語。通常指老師或教授的帶薪的長假。 111. nerd If you call someone a nerd, it means you think he is weird and not cool. A typical nerd is someone who wears glasses and carries a lot of books. As a matter of fact, when I was growing up, a lot of kids called me a nerd because I didn't fit in. 112. cheesy 就是很俗氣,品質很次,很愚蠢。人們經常用cheesy 這個詞來形容電視節目,電影或者某個人說的話。 Cheesy means tacky or dumb. It's usually used to describe a TV show, movie, or something someone says. I think the new TV soap opera on Channel 6 is so cheesy. It is fake and the things they say on the shows are so weird. I don't know why these shows are so popular. 113. wimp 軟弱的人,膽小鬼,或者是怕痛的人 A wimp is a weak person, a coward, or someone who can't take pain. 114. guts 勇氣 You only had enough guts today because I was here to support you. Usually you are a wimp! 115. take a hike -----to tell someone to leave, or to tell someone to leave you alone. If I were you, I would have told him to take a hike. 116. blow off--取消約會,或者是不做自己不想做的事 Bob and I did make plans to go out last night. But he blew me off. He decided to go out with his girlfriend. It wasn't the first time he blew me off. There are some things in life you just shouldn't blow off. 117. uptight----tense, irritable, or unable to relax. Sometimes if I feel a bit uptight, I have a few beers. That helps me relax. 118. busted ------做壞事被抓到 The police just busted someone for trying to steal my neighbor's car. 119. creeep ---A creep is someone who looks and acts in a way that makes people suspicious and uncomfortable. He was always frowning, and wouldn't say hello to people. That's one reason I thought he was a creep. 120. wasted----喝得大醉 Last night a friend and I went out to a bar and got wasted, so I don't feel very good right now. We were so wasted that we couldn't even stand up straight. 121.to get a kick out of something-----為某件事感到很高興 I said you get a kick out of watching me suffer. That means, you enjoy watching me suffer. 122. whatever 表示說話的人對對方說的話很不以為然 123.peanuts 數量很小,價值很低 A:How much money do you earn as a teaching assistant, if you don't mind my asking? B:Eight dollars? That's peanuts! 124. laid back: 形容一個人個性比較隨和,不會輕易發脾氣 Wanted: friendly, laid back female roommate to share a two bedroom apartment. 125. to play hooky: 翹課,或者裝病不去上班 I may play hooky once in a while, but I usually study hard. 126. to snap at somebody: 對某人嚷嚷,很生氣地對某人說話 I'm sorry, Mikey. I didn't mean to snap at you. It's just that right now I'm so stressed. 127. chip in: 湊錢買什麼東西,或者是湊錢付大家一起吃飯的錢 The guys and I usually each chip in a few dollars when we go out for pizza on Friday nights. 128. snail mail:通過郵局寄的信 Ever since e-mail became popular, people have used "snail mail" to talk about paper mail, because it is slower than e-mail. Everyone is so busy nowadays, no one seems to have time to write snail mail anymore. 129. to rule: 很棒 I said I rule the pool table. That means that I dominate the game.I can defeat anyone. Chinese food rules! 130. to blow one's money on something: 把錢都浪費在了某樣東西上 When we were at the mall the other day, you blew a whole week's pay on shoes 131 techie 技術專家,尤指電子電腦方面的高手 132 honcho 上司,老闆 133 weirdo/weirdie/weirdy 怪人 134 mumbo jumbo: speech one doesn't understand 135 sleep around: have sex with many people He's never at home because he sleeps around so much. 136 funky:strange; weird 137 indie film: 獨立電影 138 fool around: play around; kill time 遊蕩;鬼混 139 p-u-s-s-y: a physically weak person; wimp 140 high-maintenance: 費錢費工夫的 He considered beautiful girls too high-maintenance. 中國傳統小吃的英文表達 中國吃的文化是由來已久,但怎樣把中國吃的文化介紹出去,怎樣用英文來表達呢.雖然很多人喜歡以拼音來表達,但沒吃過中國小吃的老外肯定是不能理解的。還是讓我們一塊來學習一下吧。 中式早點 燒餅 Clay oven rolls 油條 Fried bread stick 韭菜盒Fried leek dumplings 水餃 Boiled dumplings 蒸餃 Steamed dumplings 饅頭 Steamed buns 割包 Steamed sandwich 飯團 Rice and vegetable roll 蛋餅 Egg cakes 皮蛋 100-year egg 鹹鴨蛋Salted duck egg 豆漿 Soybean milk 飯 類 稀飯 Rice porridge 白飯 Plain white rice 油飯 Glutinous oil rice 糯米飯Glutinous rice 鹵肉飯Braised pork rice 蛋炒飯Fried rice with egg 地瓜粥Sweet potato congee 面 類 餛飩面Wonton & noodles 刀削麵Sliced noodles 麻辣面Spicy hot noodles 麻醬面Sesame paste noodles 鴨肉面Duck with noodles 鱔魚面Eel noodles 烏龍面Seafood noodles 榨菜肉絲麵Pork , pickled mustard green noodles 牡蠣細面 Oyster thin noodles 板條 Flat noodles 米粉 Rice noodles 炒米粉Fried rice noodles 冬粉 Green bean noodle 湯 類 魚丸湯Fish ball soup 貢丸湯Meat ball soup 蛋花湯Egg & vegetable soup 蛤蜊湯Clams soup 牡蠣湯Oyster soup 紫菜湯Seaweed soup 酸辣湯Sweet & sour soup 餛飩湯Wonton soup 豬腸湯Pork intestine soup 肉羹湯Pork thick soup 魷魚湯Squid soup 花枝羹Squid thick soup 甜 點 愛玉 Vegetarian gelatin 糖葫蘆Tomatoes on sticks 長壽桃Longevity Peaches 芝麻球Glutinous rice sesame balls 麻花 Hemp flowers 雙胞胎Horse hooves 冰 類 綿綿冰Mein mein ice 麥角冰Oatmeal ice 地瓜冰Sweet potato ice 紅豆牛奶冰Red bean with milk ice 八寶冰Eight treasures ice 豆花 Tofu pudding 果 汁 甘蔗汁Sugar cane juice 酸梅汁Plum juice 楊桃汁Star fruit juice 青草茶Herb juice 點 心 牡蠣煎Oyster omelet 臭豆腐Stinky tofu (Smelly tofu) 油豆腐Oily bean curd 麻辣豆腐 Spicy hot bean curd 蝦片 Prawn cracker 蝦球 Shrimp balls 春捲 Spring rolls 蛋捲 Chicken rolls 碗糕 Salty rice pudding 筒仔米糕 Rice tube pudding 紅豆糕Red bean cake 綠豆糕Bean paste cake 糯米糕Glutinous rice cakes 蘿蔔糕Fried white radish patty 芋頭糕Taro cake 肉圓 Taiwanese Meatballs 水晶餃Pyramid dumplings 肉丸 Rice-meat dumplings 豆幹 Dried tofu 其 他 當歸鴨 Angelica duck 檳榔 Betel nut 火鍋 Hot pot 餐具: coffee pot 咖啡壺 coffee cup 咖啡杯 paper towel 紙巾 napkin 餐巾 table cloth 桌布 tea-pot 茶壺 tea set 茶具 tea tray 茶盤 caddy 茶罐 dish 碟 plate 盤 saucer 小碟子 rice bowl 飯碗 chopsticks 筷子 soup spoon 湯匙 knife 餐刀 cup 杯子 glass 玻璃杯 mug 馬克杯 picnic lunch 便當 fruit plate 水果盤 toothpick 牙籤 中餐: bear's paw 熊掌 breast of deer 鹿脯 beche-de-mer; sea cucumber 海參 sea sturgeon 海鱔 salted jelly fish 海蜇皮 kelp, seaweed 海帶 abalone 鮑魚 shark fin 魚翅 scallops 乾貝 lobster 龍蝦 bird's nest 燕窩 roast [內容被過濾,請注意論壇文明]ling pig 考乳豬 pig's knuckle 豬腳 boiled salted duck 鹽水鴨 preserved meat 臘肉 barbecued pork 叉燒 sausage 香腸 fried pork flakes 肉鬆 BAR-B-Q 烤肉 meat diet 葷菜 vegetables 素菜 meat broth 肉羹 local dish 地方菜 Cantonese cuisine 廣東菜 set meal 客飯 curry rice 咖喱飯 fried rice 炒飯 plain rice 白飯 crispy rice 鍋巴 gruel, soft rice, porridge 粥 noodles with gravy 打鹵麵 plain noodle 陽春麵 casserole 砂鍋 chafing dish, fire pot 火鍋 meat bun 肉包子 shao-mai 燒麥 preserved bean curd 腐乳 bean curd 豆腐 fermented blank bean 豆豉 pickled cucumbers 醬瓜 preserved egg 皮蛋 salted duck egg 鹹鴨蛋 dried turnip 蘿蔔幹 西餐與rib料理: menu 菜單 French cuisine 法國菜 today's special 今日特餐 chef's special 主廚特餐 buffet 自助餐 fast food 速食 specialty 招牌菜 continental cuisine 歐式西餐 aperitif 飯前酒 dim sum 點心 French fires 炸薯條 baked potato 烘馬鈴薯 mashed potatoes 馬鈴薯泥 omelette 簡蛋捲 pudding 布丁 pastries 甜點 pickled vegetables 泡菜 kimchi 韓國泡菜 crab meat 蟹肉 prawn 明蝦 conch 海螺 escargots 田螺 braised beef 燉牛肉 bacon 熏肉 poached egg 荷包蛋 sunny side up 煎一面荷包蛋 over 煎兩面荷包蛋 fried egg 煎蛋 over easy 煎半熟蛋 over hard 煎全熟蛋 scramble eggs 炒蛋 boiled egg 煮蛋 stone fire pot 石頭火鍋 sashi rib竹筷 sake rib米酒 miso shiru 味噌湯 roast meat 鐵板烤肉 sashimi 生魚片 butter 奶油 冷飲: beverages 飲料 soya-bean milk 豆漿 syrup of plum 酸梅湯 tomato juice 番茄汁 orange juice 橘子汁 coconut milk 椰子汁 asparagus juice 蘆薈汁 grapefruit juice 葡萄柚汁 vegetable juice 蔬菜汁 ginger ale 姜汁 sarsaparilla 沙士 soft drink 汽水 coco-cola(coke) 可口可樂 tea leaves 茶葉 black tea 紅茶 jasmine tea 茉莉(香片) tea bag 茶包 lemon tea 檸檬茶 white goup tea 冬瓜茶 honey 蜂蜜 chlorella 綠藻 soda water 蘇打水 artificial color 人工色素 ice water 冰水 mineral water 礦泉水 distilled water 蒸餾水 long-life milk 保久奶 condensed milk 煉乳; 煉奶 cocoa 可哥 coffee mate 奶精 coffee 咖啡 iced coffee 冰咖啡 white coffee 牛奶咖啡 black coffee 純咖啡 ovaltine 阿華田 chlorella yakult 養樂多 essence of chicken 雞精 ice-cream cone 甜筒 sundae 聖代; 新地 ice-cream 雪糕 soft ice-cream 窗淇淋 vanilla ice-cream 香草霜淇淋 ice candy 冰棒 milk-shake 奶昔 straw 吸管 水果: pineapple 鳳梨 watermelon 西瓜 papaya 木瓜 betelnut 檳榔 chestnut 栗子 coconut 椰子 ponkan 碰柑 tangerine 橘子 mandarin orange 橘 sugar-cane 甘蔗 muskmelon 香瓜 shaddock 文旦 juice peach 水蜜桃 pear 梨子 peach 桃子 carambola 楊桃 cherry 櫻桃 persimmon 柿子 apple 蘋果 mango 芒果 fig 無花果 water caltrop 菱角 almond 杏仁 plum 李子 honey-dew melon 哈密瓜 loquat 枇杷 olive 橄欖 rambutan 紅毛丹 durian 榴? strawberry 草莓 grape 葡萄 grapefruit 葡萄柚 lichee 荔枝 longan 龍眼 wax-apple 蓮霧 guava 芭樂 banana 香蕉 熟菜與調味品: string bean 四季豆 pea 豌豆 green soy bean 毛豆 soybean sprout 黃豆芽 mung bean sprout 綠豆芽 bean sprout 豆芽 kale 甘藍菜 cabbage 包心菜; 大白菜 broccoli 花椰菜 mater convolvulus 空心菜 dried lily flower 金針菜 mustard leaf 芥菜 celery 芹菜 tarragon 蒿菜 beetroot, beet 甜菜 agar-agar 紫菜 lettuce 生菜 spinach 菠菜 leek 韭菜 caraway 香菜 hair-like seaweed 髮菜 preserved szechuan pickle 榨菜 salted vegetable 雪裏紅 lettuce 萵苣 asparagus 蘆薈 bamboo shoot 竹筍 dried bamboo shoot 筍乾 chives 韭黃 ternip 白蘿蔔 carrot 胡蘿蔔 water chestnut 荸薺 ficus tikaua 地瓜 long crooked squash 菜瓜 loofah 絲瓜 pumpkin 南瓜 bitter gourd 苦瓜 cucumber 黃瓜 white gourd 冬瓜 gherkin 小黃瓜 yam 山芋 taro 芋頭 beancurd sheets 百葉 champignon 香菇 button mushroom 草菇 needle mushroom 金針菇 agaricus 蘑菇 dried mushroom 冬菇 tomato 番茄 eggplant 茄子 potato, spud 馬鈴薯 lotus root 蓮藕 agaric 木耳 white fungus 百木耳 ginger 生薑 garlic 大蒜 garlic bulb 蒜頭 green onion 蔥 onion 洋蔥 scallion, leek 青蔥 wheat gluten 麵筋 miso 味噌 seasoning 調味品 caviar 魚子醬 barbeque sauce 沙茶醬 tomato ketchup, tomato sauce 番茄醬 mustard 芥茉 salt 鹽 sugar 糖 monosodium glutamate, gourmet powder 味精 vinegar 醋 sweet 甜 sour 酸 bitter 苦 lard 豬油 peanut oil 花生油 soy sauce 醬油 green pepper 青椒 paprika 紅椒 star anise 八角 cinnamon 肉掛 curry 咖喱 maltose 麥芽糖 糖與蜜餞: jerky 牛肉幹 dried beef slices 牛肉片 dried pork slices 豬肉片 confection 糖果 glace fruit 蜜餞 marmalade 果醬 dried persimmon 柿餅 candied melon 冬瓜糖 red jujube 紅棗 black date 黑棗 glace date 蜜棗 dried longan 桂圓幹 raisin 葡萄乾 chewing gum 口香糖 nougat 牛乳糖 mint 薄荷糖 drop 水果糖 marshmallow 棉花糖 caramel 牛奶糖 peanut brittle 花生糖 castor sugar 細砂白糖 granulated sugar 砂糖 sugar candy 冰糖 butter biscuit 奶酥 rice cake 年糕 moon cake 月餅 green bean cake 綠豆糕 popcorn 爆米花 chocolate 巧克力 marrons glaces 唐炒栗子 牛排與酒: breakfast 早餐 lunch 午餐 brunch 早午餐 supper 晚餐 late snack 宵夜 dinner 正餐 ham and egg 火腿腸 buttered toast 奶油土司 French toast 法國土司 muffin 松餅 cheese cake 酪餅 white bread 白麵包 brown bread 黑麵包 French roll 小型法式麵包 appetizer 開胃菜 green salad 蔬菜沙拉 onion soup 洋蔥湯 potage 法國濃湯 corn soup 玉米濃湯 minestrone 蔬菜麵條湯 ox tail soup 牛尾湯 fried chicken 炸雞 roast chicken 烤雞 steak 牛排 T-bone steak 丁骨牛排 filet steak 菲力牛排 sirloin steak 沙朗牛排 club steak 小牛排 well done 全熟 medium 五分熟 rare 三分熟 beer 啤酒 draft beer 生啤酒 stout beer 黑啤酒 canned beer 罐裝啤酒 red wine 紅葡萄酒 gin 琴酒 brandy 白蘭地 whisky 威士卡 vodka 伏特加 on the rocks 酒加冰塊 rum 蘭酒 champagne 香檳 其他小吃: meat 肉 beef 牛肉 pork 豬肉 chicken 雞肉 mutton 羊肉 bread 麵包 steamed bread 饅頭 rice noodles 米粉 fried rice noodles 河粉 steamed vermicelli roll 腸粉 macaroni 通心粉 bean thread 冬粉 bean curd with odor 臭豆腐 flour-rice noodle 麵粉 noodles 麵條 instinct noodles 速食面 vegetable 蔬菜 crust 面包皮 sandwich 三明治 toast 土司 hamburger 漢堡 cake 蛋糕 spring roll 春捲 pancake 煎餅 fried dumpling 煎貼 rice glue ball 元宵 glue pudding 湯圓 millet congee 小米粥 cereal 麥片粥 steamed dumpling 蒸餃 ravioli 餛飩 nbsp;cake 月餅 green bean cake 綠豆糕 popcorn 爆米花 chocolate 巧克力 marrons glaces 唐炒栗子 英國最常用的118句口語 1. absolutely not. 絕對不是。 2. are you coming with me? 你跟我一起去嗎? 3. are you sure? 你能肯定嗎? 4. as soon as possible. 儘快。 5. believe me. 相信我。 6. buy it . 買下來! 7. call me tomorrow. 明天打電話給我。 8. can you speak slowly? 請您說得慢些好嗎? 9. come with me. 跟我來。 10. congratulations. 恭喜恭喜。 11. do it right! 把它做對。 12. do you mean it ? 你是當真的嗎? 13. do you see him often? 你經常見到他嗎? 14. do you see it? = do you understand? 你明白了嗎? 15. do you want it? 你要嗎? 16. do you want something? 你想要些什麼? 17. don't do it . 不要做。 18. don't exaggerate. 不要誇張。 19. don't tell me that. 不要告訴我。 20. give me a hand . 幫我一下。 21. go right ahead. 一直往前走。 22. have a good trip. 祝旅途愉快。 23. have a nice day. 祝你一天過得愉快。 24. have you finished? 你做完了嗎? 25. he doesn't have time. 他沒空。 26. he is on his way. 他現在已經在路上了。 27. how are you doing? 你好嗎? 28. how long are you staying ? 你要呆多久? 29. i am crazy about her. 我對她著迷了。 30. i am wasting my time . 我在浪費時間。 31. i can do it . 我能做。 32. i can't believe it . 我簡直不能相信。 33. i can't wait . 我不能再等了。 34. i don't have time . 我沒時間了。 35. i don't know anybody. 我一個人都不認識。 36. i don't like it . 我不喜歡。 37. i don't think so . 我認為不是。 38. i feel much better. 我感覺好多了。 39. i found it . 我找到了。 40. i hope so . 我希望如此。 41. i knew it . 我早知道了。 42. i noticed that. 我注意到了。 43. i see. 我明白了。 44. i speak english well. 我英語說得很好。 45. i think so . 我認為是這樣的。 46. i want to speak with him. 我想跟他說話。 47. i won. 我贏了。 48. i would like a cup of coffee, please. 請給我一杯咖啡。 49. i'm hungry. 我餓死了。 50. i'm leaving. 我要走了。 51. i'm sorry. 對不起。 52. i'm used to it . 我習慣了。 53. i'll miss you. 我會想念你的。 54. i'll try. 我試試看。 55. i'm bored. 我很無聊。 56. i'm busy. 我很忙。 57. i'm having fun. 我玩得很開心。 58. i'm ready. 我準備好了。 59. i've got it . 我明白了。 60. i've had it . 我受夠了。 61. it's incredible! 真是難以置信! 62. is it far? 很遠嗎? 63. it doesn't matter. 沒關係。 64. it smells good. 聞起來很香。 65. it's about time . 是時候了。 66. it's all right. 沒關係。 67. it's easy. 很容易。 68. it's good. 很好。 69. it's near here. 離這很近。 70. it's nothing. 沒什麼。 71. it's time to go . 該走了。 72. it's different. 那是不同的。 73. it's funny. 很滑稽。 74. it's impossible. 那是不可能的。 75. it's not bad. 還行。 76. it's not difficult. 不難. 77. it's not worth it . 不值得。 78. it's obvious. 很明顯。 79. it's the same thing. 還是一樣的。 80. it's your turn. 輪到你了。 81. let me see . 讓我想想。 82. let me know . 告訴我。 83. me too. 我也一樣。 84. not yet. 還沒有。 85. relax! 放鬆。 86. see you tomorrow. 明天見。 87. she is my best friend . 她是我最好的朋友。 88. she is so smart. 她真聰明。 89. show me . 指給我看。 90. tell me . 告訴我。 91. thank you very much. 多謝。 92. that happens. 這樣的事情經常發生。 93. that's enough. 夠了。 94. that's interesting. 很有趣。 95. that's right. 對了。 96. that's true. 這是真的。 97. there are too many people here. 這裏人很多。 98. they like each other. 他們互相傾慕。 99. think about it . 考慮一下。 100. too bad! 太糟糕啦! 101. wait for me . 等等我。 102. what did you say? 你說什麼? 103. what do you think? 你認為怎樣? 104. what is he talking about? 他在說些什麼? 105. what terrible weather! 多壞的天氣。 106. what's going on/ happening / the problem? 怎麼啦? 107. what's the date today?今天幾號? 108. where are you going ? 你去哪里? 109. where is he? 他在哪里? 110. you are impatient. 你太性急了。 111. you look tired. 你看上去很累。 112. you surprise me. 你讓我大吃一驚。 113. you're crazy. 你瘋了。 114. you're welcome. 別客氣。 115. you're always right. 你總是對的。 116. you're in a bad mood. 你的心情不好。 117. you're lying. 你在撒謊。 118. you're wrong. 你錯了。 July 14 只是雜談.Dear Michael:
我了解你對人生的徬徨與無助,想要找出一個確定的方向是多麼困難的一件事,不管對誰來說都不容易,每個人不過都是走一步算一步,即使是很有規劃的人也無法避免的必須時時修正每一步,因為生命中有許多事情是無法預期的,昨天看到一篇文章講到蘋果電腦CEO賈伯斯(Jobs)的一些分享,提到他每天都會問自己,如果今天是生命的最後一天,今天他打算要做的事是不是的確是他想完成的事?會不會後悔花這些時間?如果持續好幾天都是反面的答案,就會考慮調整自我的步伐,檢視目前的工作是否已經偏移了人生真正的目標.
對於某部份人來說,追求卓越,追求自我極限是生命中最重要的事,目標是爬到高峰,賺到金錢,勝過其他人,這一類人是以成就來評斷一個人的價值,而我想我的人生希望能追求一種平衡的狀態,不管我追求什麼樣的事物都不希望破壞這種平衡,這種平衡包括了內心的平靜以及良好身體狀態與人際關係,人際關係包括了家人和朋友.如果為了追求某樣事物而把這個平衡傾倒了,即使我得到了這樣事物也不會有真正的快樂,因為在度過生命這些充滿了不確定感的日子以來,我愈來愈能確定真正對我來說重要的一些東西,首要的便是內心的平靜.
老子認為無欲則剛,我深有同感,當一個人不在物質上或在精神上需求任何東西的時候,他已經成為了一個超人,沒有什麼事物可以用來要脅他,但是這種境界我不認為是一般人能夠達到的,或許能夠接近這種境界的話就已經感到很滿足了;另外生命所必須的還有健康的身體狀態和良好人際關係,這兩個要求聽起來或許和無欲相牴觸,但其實並沒有,這兩樣需求是人生快樂的基礎也是內心平靜的基礎,如果拿掉兩者之一,也難以達到無欲的境界了,生病則必然會希望能離開生病狀態,與家人朋友維持良好關係不會影響到對於超人境界的追求,違反天性與人群背離的話我認為反而容易破壞人心情的平衡狀態,因人類天性使然,親近的人最易於影響自己,以上三樣事物是我認為在人生中最重要的事物,不管未來人生怎麼規劃都不應該破壞這些事物的平衡.
無欲並不代表我將完全不追求超越自我,而是把超越自我當作是一件與刷牙洗臉同等級的事物,如果能夠養成這個好習慣,對我或是對我能影響的人來說是件好事情,那麼就應該去作,不是為了完成這件事本身,而是因為完成這件事是有益自我有益他人的,若為了達成它來滿足自我就變成有慾而去追求了;另外鞭策自己維持內心的平靜也應當視為一種好習慣的養成,不該視為有欲望追求某件事物,因為沒有養成這個好習慣的話也不會讓自己內心的平衡被破壞掉,這種說法可以作為一種基準,用來判斷是否為了追求某件事物而造成內心的波動,倘若有便是將無欲狀態破壞掉了,我希望能夠盡量避免這種情況的發生.讓人生的這三個基礎能作為我個人哲學的基石.用一種平實穩定的心情去渡過人生,也秉持安定的步伐去督促自我讓人生有價值對他人有所增益,一步一腳印才走的遠走的長走的久,也才能夠在平衡狀態有最大的產出,生命固然有限,但生命所能創造的價值則無限. Joel on Software周思博趣談軟體
作者: 周思博 (Joel Spolsky) 譯: Paul May 梅普華 編輯: Nick Wong 2000.8.9 聽說過SEMA嗎? 這是一套相當深奧的系統, 可以測量軟體團隊的好壞. 等一下! 不要急著連過去看. 光是要搞懂那東西大概就要花上六年了. 所以我自己有一套無責任的簡易方法來衡量軟體團隊的品質. 這套方法的好處是只要花3分鐘左右. 省下的時間足夠讓你唸趟醫學院.
The Joel Test
<詳全文> http://chinesetrad.joelonsoftware.com/Articles/TheJoelTest.html 如何用正確的方法來寫出品質好的軟體的75條體會(含解釋)如何用正確的方法來寫出品質好的軟體的75條體會 (mvm)本文轉載自 mvm 的 blog:屋頂上的木帷幕 http://blog.joycode.com/mvm
July 12 Oracle備份與復原案例來源 -> http://epub.itpub.net/5/1.htm Oracle備份與復原案例 By Piner 一. 了解什麼是資料庫復原 當我們使用一個資料庫時,總希望資料庫的內容是可靠的、正確的,但由於電腦系統的故障(硬體故障、軟體故障、網路故障、執行序故障和系統故障)影響資料庫系統的操作,影響資料庫中資料的正確性,甚至破壞資料庫,使資料庫中全部或部分資料丟失。因此當發生上述故障後,希望能重構這個完整的資料庫,該處理稱為資料庫復原。復原過程大致可以分為回復 (Restore)與復原(Recover)過程。 資料庫復原可以分為以下兩類: 1.1實例故障的一致性復原 當實例意外地(如電力中斷、後臺執行序故障等)或預料地(發出SHUTDOUM ABORT語句)中止時出現實例故障,此時需要實例復原。實例復原將資料庫復原到故障之前的事務一致狀態。如果在線上後備發現實例故障,則需介質復原。在其他情況Oracle在下次資料庫起動時(對新實例裝配和打開),自動地執行實例復原。如果需要,從裝配狀態變為打開狀態,自動地激發實例復原,由下列處理: (1) 為瞭解復原資料檔案中沒有記錄的資料,進行向前滾。該資料記錄在線上日誌,包括對回滾段的內容復原。(2) 回滾未提交的事務,按步1重新生成回滾段所指定的操作。(3) 釋放在故障時正在處理事務所持有的資源。(4) 解決在故障時正經歷一階段提交的任何懸而未決的分佈事務。 1.2介質故障或檔錯誤的不一致復原 介質故障是當一個檔、一個檔的部分或磁片不能讀或不能寫時出現的故障。檔錯誤一般指意外的錯誤導致檔被刪除或意外事故導致檔的不一致。這種狀態下的資料庫都是不一致的,需要DBA手工來進行資料庫的復原,這種復原有兩種形式,決定於資料庫運行的歸檔方式和備份方式。 (1) 完全介質復原可復原全部丟失的修改。一般情況下需要有資料庫的備份且資料庫運行在歸檔狀態下並且有可用歸檔日誌時才可能。對於不同類型的錯誤,有不同類型的完全復原可使用,其決定於毀壞檔和資料庫的可用性。 (2) 不完全介質復原是在完全介質復原不可能或不要求時進行的介質復原。重構受損的資料庫,使其復原介質故障前或用戶出錯之前的一個事務一致性狀態。不完全介質復原有不同類型的使用,決定於需要不完全介質復原的情況,有下列類型:基於撤銷、基於時間和基於修改的不完全復原。 基於撤銷(CANCEL)復原:在某種情況,不完全介質復原必須被控制,DBA可撤銷在指定點的操作。基於撤銷的復原地在一個或多個日誌組(線上的或歸檔的)已被介質故障所破壞,不能用於復原過程時使用,所以介質復原必須控制,以致在使用最近的、未損的日誌組於資料檔案後中止復原操作。 基於時間(TIME)和基於修改(SCN)的復原:如果DBA希望復原到過去的某個指定點,是一種理想的不完全介質復原,一般發生在復原到某個特定操作之前,復原到如意外刪除某個資料表之前。 第二章. 資料庫復原案例測試環境 2.1 資料庫環境以下的所有案例都是通過測試經過,環境為: OS:Windows 2000 Server DB:Oracle 816 DBNAME:TEST 資料檔案: SQL> select file#,status,enabled,name from v$datafile; FILE# STATUS ENABLED NAME ---------------------------------------------------------------- 1 SYSTEM READ WRITE D:\Oracle\ORADATA\TEST\SYSTEM01.DBF 2 ONLINE READ WRITE D:\Oracle\ORADATA\TEST\RBS01.DBF 3 ONLINE READ WRITE D:\Oracle\ORADATA\TEST\USERS01.DBF 4 ONLINE READ WRITE D:\Oracle\ORADATA\TEST\TEMP01.DBF 5 ONLINE READ WRITE D:\Oracle\ORADATA\TEST\TOOLS01.DBF 6 ONLINE READ WRITE D:\Oracle\ORADATA\TEST\INDX01.DBF 控制文件: SQL> select * from v$controlfile; STATUS NAME --------------------------------------------------------------------- D:\Oracle\ORADATA\TEST\CONTROL01.CTL D:\Oracle\ORADATA\TEST\CONTROL02.CTL D:\Oracle\ORADATA\TEST\CONTROL03.CTL 上線日誌: SQL> select * from v$logfile; GROUP# STATUS MEMBER --------------------------------------------------------------------- 1 STALE D:\Oracle\ORADATA\TEST\REDO01.LOG 2 D:\Oracle\ORADATA\TEST\REDO02.LOG 3 STALE D:\Oracle\ORADATA\TEST\REDO03.LOG 2.2 資料庫備份腳本冷備份腳本: rem script:coldbak.sql rem creater:chenjiping rem date:5.8.2003 rem desc:offline full backup database --connect database connect internal/password; --shutdown database shutdown immediate; --Copy Data file !xcopy d:\Oracle\oradata\test\*.dbf d:\database/H/R; --Copy Control file !xcopy d:\Oracle\oradata\test\*.ctl d:\database/H/R; --Copy Log file !xcopy d:\Oracle\oradata\test\*.log d:\database/H/R; --startup database startup; 說明: 1、以上腳本在資料庫關閉狀態下備份資料庫所有的資料檔案,上線日誌,控制檔(在一個目錄下),如果成功備份,所有檔是一致的; 2、沒有備份參數檔,參數檔可以另外備份,沒有必要每次都備份,只需要在改變設置後備份一次; 3、如果以上命令沒有成功依次執行,那麼備份將是無效的,如連接資料庫不成功,那麼肯定關閉資料庫也不成功,那麼備份則無效; 4、冷備份建議下人工干預下執行。 資料庫OS熱全備份腳本 rem script:hotbak.sql rem creater:chenjiping rem date:5.8.2003 rem desc:backup all database datafile in archive --connect database connect internal/password; --archive alter system archive log current; --start alter tablespace system begin backup; !xcopy d:\Oracle\oradata\test\system01.dbf d:\databak/H/R; alter tablespace system end backup; alter tablespace rbs begin backup; !xcopy d:\Oracle\oradata\test\rbs01.dbf d:\databak/H/R; alter tablespace rbs end backup; alter tablespace users begin backup; !xcopy d:\Oracle\oradata\test\users01.dbf d:\databak/H/R; alter tablespace users end backup; alter tablespace tools begin backup; !xcopy d:\Oracle\oradata\test\tools01.dbf d:\databak/H/R; alter tablespace tools end backup; alter tablespace indx begin backup; !xcopy d:\Oracle\oradata\test\indx01.dbf d:\databak/H/R; alter tablespace indx end backup; --end --bak control file --binary alter database backup controlfile to 'd:\databak\controlbinbak.000'; --ascii alter database backup controlfile to trace; alter system archive log current; 說明: 1、熱備份必須在資料庫歸檔方式下才可以運行; 2、以上腳本可以在資料庫運行狀態下備份資料庫所有的資料檔案(除了臨時資料檔案),沒有必要備份上線日誌; 3、歸檔日誌至少需要一次完整備份之後的所有日誌; 4、如果以上命令沒有成功依次執行,那麼備份也是無效的,如連接資料庫不成功,那麼備份則無效。 RMAN備份只講敘有復原目錄的情況,如果沒有復原目錄,情形大致相似。以下是RMAN的熱備份全備份的腳本: # script:bakup.rcv # creater:chenjiping # date:5.8.2003 # desc:backup all database datafile in archive with rman # connect database connect rcvcat rman/rman@back; connect target internal/virpure; # start backup database run{ allocate channel c1 type disk; backup full tag 'dbfull' format 'd:\backup\full%u_%s_%p' database include current controlfile; sql 'alter system archive log current'; release channel c1; } # end 說明: 1、 資料庫必須運行在歸檔模式下; 2、 RMAN將自動備份資料檔案,運行可靠; 3、 歸檔日誌另外備份處理,但至少需要保存一次備份來的日誌; 4、 沒有必要用RMAN做冷備份,效果不好。 以上舉例說明了資料庫的復原案例的測試環境與部分備份測試腳本,其他的備份腳本可以根據以上腳本演變而來或在案例中加以說明。資料庫的自動實例將不加以說明,這裏只舉例說明媒體錯誤或人為錯誤造成的復原可能。以上包括以下案例都是在WINDOWS+Oracle816上測試驗證的,在不同的作業系統與不同的資料庫版本中略有差別。 第三章. 瞭解與復原相關的資訊 1、 了解警報日誌檔警報日誌檔一般記載了資料庫的啟動/關閉資訊,歸檔資訊,備份資訊,復原資訊,常見錯誤資訊,部分資料庫修改記錄等。一般命名規則為Alrt.log或Alrt.log,如我的測試資料庫的警報日誌檔的名稱為testalrt.log。 警報日誌檔的路徑是根據初始化參數background_dump_dest來決定的,如在我的機器上,該參數值為 D:\Oracle\admin\test\bdump,那麼,你就可以在該路徑下找到該檔。 2、 後臺執行序追蹤檔後臺執行序追蹤檔的路徑與警報日誌檔的路徑一致,在某些情況下,你可以通過後臺追蹤檔的資訊瞭解更多的需要復原的資訊。如在資料庫需要復原的時候,警報日誌檔中常有這樣的語句: Errors in file D:\Oracle\admin\test\bdump\testDBW0.TRC: ORA-01157: cannot identify/lock data file 1 - see DBWR trace file 通過提示的DBWR追蹤檔,可以查詢到更詳細的資訊。 3、 v$recover_file與v$recovery_log 這是兩個動態性能視觀表,可以在mount下查看,通過這兩個視觀表,你可以瞭解詳細的需要復原的資料檔案與需要使用到的歸檔日誌。 第四章. 資料庫復原案例 4.1非歸檔模式下的備份與復原 備份方案:採用OS冷備份 1. 連接資料庫並建立測試表 SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int); Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2. 備份資料庫 SQL> @coldbak.sql 或在DOS下 svrmgrl @coldbak.sql 3. 再插入記錄 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A ------------------- 1 2 4. 關閉資料庫 SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down. 5. 毀壞一個或多個資料檔案,如刪除user01.dbf C:\>del D:\Oracle\ORADATA\TEST\USERS01.DBF 模擬媒體毀壞。 6. 重新啟動資料庫,會發現如下錯誤 SQL> startup Oracle instance started. Total System Global Area 102020364 bytes Fixed Size 70924 bytes Variable Size 85487616 bytes Database Buffers 16384000 bytes Redo Buffers 77824 bytes Database mounted. ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: 'D:\Oracle\ORADATA\TEST\USERS01.DBF' 在警報檔中,會有更詳細的資訊 Errors in file D:\Oracle\admin\test\bdump\testDBW0.TRC: ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: 'D:\Oracle\ORADATA\TEST\USERS01.DBF' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 7. 拷貝備份回復到原來位置(restore過程) C:\>xcopy d:\database\*.* d:\Oracle\oradata\test/H/R/S 8. 打開資料庫,檢查資料 SQL> alter database open; Database altered. SQL> select * from test; A --------------------------------------- 1 這裏可以發現,資料庫復原成功,但在備份之後與崩潰之前的資料丟失了。 說明: 1、非歸檔模式下的復原方案可選性很小,一般情況下只能有一種復原方式,就是資料庫的冷備份的完全復原,僅僅需要拷貝原來的備份就可以(restore),不需要recover; 2、這種情況下的復原,可以完全復原到備份的點上,但是可能是丟失資料的,在備份之後與崩潰之前的資料將全部丟失; 3、不管毀壞了多少資料檔案或是上線日誌或是控制檔,都可以通過這個辦法復原,因為這個復原過程是Restore所有的冷備份檔案,而這個備份點上的所有檔是一致的,與最新的資料庫沒有關係,就好比把資料庫又放到了一個以前的"點"上; 4、對於非歸檔模式下,最好的辦法就是採用OS的冷備份,建議不要用RMAN來作冷備份,效果不好,因為RMAN不備份上線日誌,restore不能根本解決問題; 5、如果沒有備份上線日誌,如RMAN的備份,就需要利用不完全復原(until cancel)的方法來重新建立上線日誌檔。 4.2歸檔模式下丟失或損壞一個資料檔案 4.2.1 OS備份方案在歸檔方式下損壞或丟失一個資料檔案,如果存在相應的備份與該備份以來的歸檔日誌,復原還是比較簡單的,可以作到儘量少的Down機時間,並能作到資料庫的完全復原。 1、 連接資料庫,建立測試表並插入記錄 SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int) tablespace users; Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2、 備份資料庫 SQL> @hotbak.sql 或在DOS下 svrmgrl @hotbak.sql 3、 繼續在測試表中插入記錄 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A -------------------------------------- 1 2 SQL> alter system switch logfile; System altered. SQL> alter system switch logfile; System altered. 4、 關閉資料庫,模擬丟失資料檔案 SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down C:\>del D:\Oracle\ORADATA\TEST\USERS01.DBF 模擬媒體毀壞。 5、 啟動資料庫錯誤,離線該資料檔案: SQL> startup Oracle instance started. Total System Global Area 102020364 bytes Fixed Size 70924 bytes Variable Size 85487616 bytes Database Buffers 16384000 bytes Redo Buffers 77824 bytes Database mounted. ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: 'D:\Oracle\ORADATA\TEST\USERS01.DBF' 還可以查看警報檔(見上一個復原案例)或動態視觀表v$recover_file 如SQL> select * from v$recover_file; FILE# ONLINE ERROR CHANGE# TIME ---------- ------- ------------------ ---------- ----------- 3 ONLINE 1013500 2003-05-07 離線資料檔案 SQL> alter database datafile 3 offline drop; Database altered. 6、 打開資料庫,拷貝備份回來(restore),復原(recover)該資料檔案,並上線: SQL> alter database open; Database altered. 拷貝備份從備份處 copy d:\databak\ users01.dbf d:\Oracle\oradata\test; 復原該資料檔案 SQL> recover datafile 3; ORA-00279: change 1053698 generated at 05/07/2003 17:51:26 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00304.ARC ORA-00280: change 1053698 for thread 1 is in sequence #304 Specify log: {=suggested | filename | AUTO | CANCEL} AUTO ORA-00279: change 1053701 generated at 05/07/2003 17:51:39 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00305.ARC ORA-00280: change 1053701 for thread 1 is in sequence #305 ORA-00278: log file 'D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00304.ARC' no longer needed for this recovery Log applied. Media recovery complete. 復原成功,上線該資料檔案 SQL> alter database datafile 3 online; Database altered. 7、 檢查資料庫的資料(完全復原) SQL> select * from test; A -------------------------------- 1 2 說明: 1、採用熱備份,需要運行在歸檔模式下,可以實現資料庫的完全復原,也就是說,從備份後到資料庫崩潰時的資料都不會丟失; 2、可以採用全備份資料庫的方式備份,對於特殊情況,也可以只備份特定的資料檔案,如只備份用戶表空間(一般情況下對於某些寫特別頻繁的資料檔案,可以單獨加大備份頻率); 3、如果在復原過程中,發現損壞的是多個資料檔案,即可以採用一個一個資料檔案的復原方法(第5步中需要對資料檔案一一離線,第6步中需要對資料檔案分別復原),也可以採用整個資料庫的復原方法; 4、如果是系統表空間的損壞,不能採用此方法。 4.2.2 RMAN備份方案 RMAN也可以進行上線備份,而且備份與復原方法將比OS備份更簡單可靠。 1、連接資料庫,建立測試表並插入記錄 SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int) tablespace users; Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2、 備份資料庫表空間users C:\>rman Recovery Manager: Release 8.1.6.0.0 - Production RMAN> connect rcvcat rman/rman@back RMAN-06008: connected to recovery catalog database RMAN> connect target internal/virpure RMAN-06005: connected to target database: TEST (DBID=1788174720) RMAN> run{ 2> allocate channel c1 type disk; 3> backup tag 'tsuser' format 'd:\backup\tsuser_%u_%s_%p' 4> tablespace users; 5> release channel c1; 6> } RMAN-03022: compiling command: allocate RMAN-03023: executing command: allocate RMAN-08030: allocated channel: c1 RMAN-08500: channel c1: sid=16 devtype=DISK RMAN-03022: compiling command: backup RMAN-03025: performing implicit partial resync of recovery catalog RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-03023: executing command: backup RMAN-08008: channel c1: starting full datafile backupset RMAN-08502: set_count=5 set_stamp=494177612 creation_time=16-MAY-03 RMAN-08010: channel c1: specifying datafile(s) in backupset RMAN-08522: input datafile fno=00003 name=D:\Oracle\ORADATA\TEST\USER01.DBF RMAN-08013: channel c1: piece 1 created RMAN-08503: piece handle=D:\BACKUP\TSUSER_05EN93AC_5_1 comment=NONE RMAN-08525: backup set complete, elapsed time: 00:00:01 RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-03022: compiling command: release RMAN-03023: executing command: release RMAN-08031: released channel: c1 RMAN> 3、 繼續在測試表中插入記錄 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A --------------------------------------- 1 2 SQL> alter system switch logfile; System altered. SQL>r 1* alter system switch logfile; System altered. 4、 關閉資料庫,模擬丟失資料檔案 SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down C:\>del D:\Oracle\ORADATA\TEST\USER01.DBF 5、 啟動資料庫,檢查錯誤 SQL> startup Oracle instance started. Total System Global Area 102020364 bytes Fixed Size 70924 bytes Variable Size 85487616 bytes Database Buffers 16384000 bytes Redo Buffers 77824 bytes Database mounted. ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: 'D:\Oracle\ORADATA\TEST\USER01.DBF' 6、 先打開資料庫 SQL> alter database datafile 3 offline drop; Database altered. SQL> alter database open; Database altered. 7、 復原該表空間復原腳本可以是復原單個資料檔案 run{ allocate channel c1 type disk; restore datafile 3; recover datafile 3; sql 'alter database datafile 3 online'; release channel c1; } 也可以是,復原表空間 run{ allocate channel c1 type disk; restore tablespace users; recover tablespace users; sql 'alter database datafile 3 online'; release channel c1; } 過程如下: C:\>rman Recovery Manager: Release 8.1.6.0.0 - Production RMAN> connect rcvcat rman/rman@back RMAN-06008: connected to recovery catalog database RMAN> connect target internal/virpure RMAN-06005: connected to target database: TEST (DBID=1788174720) RMAN> run{ 2> allocate channel c1 type disk; 3> restore datafile 3; 4> recover datafile 3; 5> sql 'alter database datafile 3 online'; 6> release channel c1; 7> } //輸出內容冗長,省略--編者 RMAN> 8、 檢查資料是否完整 SQL> alter database open; Database altered. SQL> select * from test; A --------------------------------------- 1 2 說明: 1、RMAN也可以實現單個表空間或資料檔案的復原,復原過程可以在mount下或open方式下,如果在open方式下復原,可以減少down機時間; 2、如果損壞的是一個資料檔案,建議offline並在open方式下復原; 3、這裏可以看到,RMAN進行資料檔案與表空間復原的時候,代碼都比較簡單,而且能保證備份與復原的可靠性,所以建議採用RMAN的備份與復原. 4.3丟失多個資料檔案,實現整個資料庫的復原. 4.3.1 OS備份方案 OS備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的復原 1、 連接資料庫,建立測試表並插入記錄 SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int); Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2、 備份資料庫,備份除臨時資料檔案後的所資料檔案 SQL> @hotbak.sql 或在DOS下 svrmgrl @hotbak.sql 3、 繼續在測試表中插入記錄 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A --------------------------------------- 1 2 SQL> alter system switch logfile; System altered. SQL> alter system switch logfile; System altered. 4、 關閉資料庫,模擬丟失資料檔案 SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down C:\>del D:\Oracle\ORADATA\TEST\SYSTEM01.DBF C:\>del D:\Oracle\ORADATA\TEST\INDX01.DBF C:\>del D:\Oracle\ORADATA\TEST\TOOLS01.DBF C:\>del D:\Oracle\ORADATA\TEST\RBS01.DBF 模擬媒體毀壞(這裏刪除多個資料檔案) 5、 啟動資料庫,檢查錯誤 SQL> STARTUP Oracle instance started. Total System Global Area 102020364 bytes Fixed Size 70924 bytes Variable Size 85487616 bytes Database Buffers 16384000 bytes Redo Buffers 77824 bytes Database mounted. ORA-01157: cannot identify/lock data file 1 - see DBWR trace file ORA-01110: data file 1: 'D:\Oracle\ORADATA\TEST\SYSTEM01.DBF' 詳細資訊可以查看警報檔 ORA-1157 signalled during: ALTER DATABASE OPEN... Thu May 08 09:39:36 2003 Errors in file D:\Oracle\admin\test\bdump\testDBW0.TRC: ORA-01157: cannot identify/lock data file 1 - see DBWR trace file ORA-01110: data file 1: 'D:\Oracle\ORADATA\TEST\SYSTEM01.DBF' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 Thu May 08 09:39:36 2003 Errors in file D:\Oracle\admin\test\bdump\testDBW0.TRC: ORA-01157: cannot identify/lock data file 2 - see DBWR trace file ORA-01110: data file 2: 'D:\Oracle\ORADATA\TEST\RBS01.DBF' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 Thu May 08 09:39:36 2003 Errors in file D:\Oracle\admin\test\bdump\testDBW0.TRC: ORA-01157: cannot identify/lock data file 5 - see DBWR trace file ORA-01110: data file 5: 'D:\Oracle\ORADATA\TEST\TOOLS01.DBF' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 Thu May 08 09:39:36 2003 Errors in file D:\Oracle\admin\test\bdump\testDBW0.TRC: ORA-01157: cannot identify/lock data file 6 - see DBWR trace file ORA-01110: data file 6: 'D:\Oracle\ORADATA\TEST\INDX01.DBF' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 通過查詢v$recover_file可以看到 SQL> select * from v$recover_file; FILE# ONLINE ERROR CHANGE# TIME ---------- ------- ------------------ ---------- ----------- 1 ONLINE FILE NOT FOUND 0 2 ONLINE FILE NOT FOUND 0 5 ONLINE FILE NOT FOUND 0 6 ONLINE FILE NOT FOUND 0 有四個資料檔案需要復原 6、 拷貝備份回到原地點(restore),開始復原資料庫(recover) restore過程: C:\>copy D:\DATABAK\SYSTEM01.DBF D:\Oracle\ORADATA\TEST\ C:\>copy D:\DATABAK\TEST\INDX01.DBF D:\Oracle\ORADATA\TEST\ C:\>copy D:\DATABAK\TEST\TOOLS01.DBF D:\Oracle\ORADATA\TEST\ C:\>copy D:\DATABAK\TEST\RBS01.DBF.DBF D:\Oracle\ORADATA\TEST\ Recover過程: SQL> recover database; ORA-00279: change 1073849 generated at 05/08/2003 08:58:35 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00311.ARC ORA-00280: change 1073849 for thread 1 is in sequence #311 Specify log: {=suggested | filename | AUTO | CANCEL} auto ORA-00279: change 1073856 generated at 05/08/2003 09:03:27 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00312.ARC ORA-00280: change 1073856 for thread 1 is in sequence #312 ORA-00278: log file 'D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00311.ARC' no longer needed for this recovery ORA-00279: change 1073858 generated at 05/08/2003 09:11:43 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00313.ARC ORA-00280: change 1073858 for thread 1 is in sequence #313 ORA-00278: log file 'D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00312.ARC' no longer needed for this recovery ORA-00279: change 1073870 generated at 05/08/2003 09:11:46 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00314.ARC ORA-00280: change 1073870 for thread 1 is in sequence #314 ORA-00278: log file 'D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00313.ARC' no longer needed for this recovery Log applied. Media recovery complete. 7、 打開資料庫,檢查資料庫的資料(完全復原) SQL> alter database open; Database altered. SQL> select * from test; A --------------------------------------- 1 2 說明: 1、只要有備份與歸檔存在,就可以實現資料庫的完全復原(不丟失資料); 2、適合於丟失大量資料檔案,或包含系統資料檔案在內的資料庫的復原; 3、復原過程在mount下進行,如果復原成功,再打開資料庫,down機時間可能比較長一些。 4.3.2 RMAN備份方案 RMAN備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的復原 1、連接資料庫,建立測試表並插入記錄 SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int); Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2、備份資料庫 DOS下 C:>\ rman cmdfile=bakup.rcv msglog=backup.log; 以下是backup.log內容。 Recovery Manager: Release 8.1.6.0.0 - Production RMAN> # script:bakup.rcv 2> # creater:chenjiping 3> # date:5.8.2003 4> # desc:backup all database datafile in archive with rman 5> 6> #connect database 7> connect rcvcat rman/rman@back; 8> connect target internal/virpure; 9> 10> #start backup database 11> run{ 12> allocate channel c1 type disk; 13> backup full tag 'dbfull' format 'd:\backup\full%u_%s_%p' database 14> include current controlfile; 15> sql 'alter system archive log current'; 16> release channel c1; 17> } 18> #end 19> RMAN-06008: connected to recovery catalog database RMAN-06005: connected to target database: TEST (DBID=1788174720) RMAN-03022: compiling command: allocate RMAN-03023: executing command: allocate RMAN-08030: allocated channel: c1 RMAN-08500: channel c1: sid=15 devtype=DISK RMAN-03022: compiling command: backup RMAN-03023: executing command: backup RMAN-08008: channel c1: starting full datafile backupset RMAN-08502: set_count=4 set_stamp=494074368 creation_time=15-MAY-03 RMAN-08010: channel c1: specifying datafile(s) in backupset RMAN-08522: input datafile fno=00002 name=D:\Oracle\ORADATA\TEST\RBS01.DBF RMAN-08522: input datafile fno=00001 name=D:\Oracle\ORADATA\TEST\SYSTEM01.DBF RMAN-08011: including current controlfile in backupset RMAN-08522: input datafile fno=00005 name=D:\Oracle\ORADATA\TEST\TOOLS01.DBF RMAN-08522: input datafile fno=00004 name=D:\Oracle\ORADATA\TEST\TEMP01.DBF RMAN-08522: input datafile fno=00006 name=D:\Oracle\ORADATA\TEST\INDX01.DBF RMAN-08522: input datafile fno=00003 name=D:\Oracle\ORADATA\TEST\USER01.DBF RMAN-08013: channel c1: piece 1 created RMAN-08503: piece handle=D:\BACKUP\FULL04EN5UG0_4_1 comment=NONE RMAN-08525: backup set complete, elapsed time: 00:01:16 RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-03022: compiling command: sql RMAN-06162: sql statement: alter system archive log current RMAN-03023: executing command: sql RMAN-03022: compiling command: release RMAN-03023: executing command: release RMAN-08031: released channel: c1 Recovery Manager complete. 到這裏表示備份成功。 3、 繼續在測試表中插入記錄 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A --------------------------------------- 1 2 SQL>alter system switch logfile; System altered. SQL> alter system switch logfile; System altered. 4、 關閉資料庫,模擬丟失資料檔案 SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down C:\>del D:\Oracle\ORADATA\TEST\SYSTEM01.DBF C:\>del D:\Oracle\ORADATA\TEST\INDX01.DBF C:\>del D:\Oracle\ORADATA\TEST\TOOLS01.DBF C:\>del D:\Oracle\ORADATA\TEST\RBS01.DBF 5、啟動資料庫,檢查錯誤 SQL> STARTUP Oracle instance started. Total System Global Area 102020364 bytes Fixed Size 70924 bytes Variable Size 85487616 bytes Database Buffers 16384000 bytes Redo Buffers 77824 bytes Database mounted. ORA-01157: cannot identify/lock data file 1 - see DBWR trace file ORA-01110: data file 1: 'D:\Oracle\ORADATA\TEST\SYSTEM01.DBF' 查詢v$recover_file SQL> select * from v$recover_file; FILE# ONLINE ERROR CHANGE# TIME ---------- ------- ------------------ ---------- ----------- 1 ONLINE FILE NOT FOUND 0 2 ONLINE FILE NOT FOUND 0 5 ONLINE FILE NOT FOUND 0 6 ONLINE FILE NOT FOUND 0 可以知道有四個資料檔案需要復原. 6、利用RMAN進行復原 C:\>rman Recovery Manager: Release 8.1.6.0.0 - Production RMAN> connect rcvcat rman/rman@back RMAN-06008: connected to recovery catalog database RMAN> connect target internal/virpure RMAN-06005: connected to target database: TEST (DBID=1788174720) RMAN> run{ 2> allocate channel c1 type disk; 3> restore database; 4> recover database; 5> sql 'alter database open'; 6> release channel c1; 7> } RMAN-03022: compiling command: allocate RMAN-03023: executing command: allocate RMAN-08030: allocated channel: c1 RMAN-08500: channel c1: sid=17 devtype=DISK RMAN-03022: compiling command: restore RMAN-03025: performing implicit partial resync of recovery catalog RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-03022: compiling command: IRESTORE RMAN-03023: executing command: IRESTORE RMAN-08016: channel c1: starting datafile backupset restore RMAN-08502: set_count=4 set_stamp=494074368 creation_time=15-MAY-03 RMAN-08089: channel c1: specifying datafile(s) to restore from backup set RMAN-08523: restoring datafile 00001 to D:\Oracle\ORADATA\TEST\SYSTEM01.DBF RMAN-08523: restoring datafile 00002 to D:\Oracle\ORADATA\TEST\RBS01.DBF RMAN-08523: restoring datafile 00003 to D:\Oracle\ORADATA\TEST\USER01.DBF RMAN-08523: restoring datafile 00004 to D:\Oracle\ORADATA\TEST\TEMP01.DBF RMAN-08523: restoring datafile 00005 to D:\Oracle\ORADATA\TEST\TOOLS01.DBF RMAN-08523: restoring datafile 00006 to D:\Oracle\ORADATA\TEST\INDX01.DBF RMAN-08023: channel c1: restored backup piece 1 RMAN-08511: piece handle=D:\BACKUP\FULL04EN5UG0_4_1 tag=DBFULL params=NULL RMAN-08024: channel c1: restore complete RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-03022: compiling command: recover RMAN-03022: compiling command: recover(1) RMAN-03022: compiling command: recover(2) RMAN-03022: compiling command: recover(3) RMAN-03023: executing command: recover(3) RMAN-08054: starting media recovery RMAN-03022: compiling command: recover(4) RMAN-06050: archivelog thread 1 sequence 327 is already on disk as file D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00327.ARC RMAN-06050: archivelog thread 1 sequence 328 is already on disk as file D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00328.ARC RMAN-06050: archivelog thread 1 sequence 329 is already on disk as file D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00329.ARC RMAN-06050: archivelog thread 1 sequence 330 is already on disk as file D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00330.ARC RMAN-03023: executing command: recover(4) RMAN-08515: archivelog filename=D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00327.ARC thread=1 sequence=327 RMAN-08515: archivelog filename=D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00328.ARC thread=1 sequence=328 RMAN-08055: media recovery complete RMAN-03022: compiling command: sql RMAN-06162: sql statement: alter database open RMAN-03023: executing command: sql RMAN-03022: compiling command: release RMAN-03023: executing command: release RMAN-08031: released channel: c1 RMAN> 7、 檢查資料庫的資料(完全復原) SQL> select * from test; A --------------------------------------- 1 2 說明: 1、只要有備份與歸檔存在,RMAN也可以實現資料庫的完全復原(不丟失資料); 2、同OS備份資料庫復原,適合於丟失大量資料檔案,或包含系統資料檔案在內的資料庫的復原; 3、目標資料庫在mount下進行,如果復原成功,再打開資料庫; 4、RMAN的備份與復原命令相對比較簡單並可靠,建議有條件的話,都採用RMAN進行資料庫的備份。 4.4 不完全復原案例 4.4.1 OS備份下的基於時間的復原 不完全復原可以分為基於時間的復原,基於改變的復原與基於撤銷的復原,這裏已基於時間的復原為例子來說明不完全復原過程。 基於時間的復原可以不完全復原到現在時間之前的某一個時間,對於某些誤操作,如刪除了一個資料表,可以在備用復原環境上復原到表的刪除時間之前,然後把該表導出到正式環境,避免一個人為的錯誤。 1、 連接資料庫,建立測試表並插入記錄: SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int); Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2、 備份資料庫,這裏最好備份所有的資料檔案,包括臨時資料檔案: SQL> @hotbak.sql 或在DOS下 svrmgrl @hotbak.sql 或冷備份也可以 3、 刪除測試表,假定刪除前的時間為T1,在刪除之前,便於測試,繼續插入資料並應用到歸 檔。 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A --------------------------------------- 1 2 SQL> alter system switch logfile; Statement processed. SQL> alter system switch logfile; Statement processed. SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual; TO_CHAR(SYSDATE,'YY ------------------- 2003-05-21 14:43:01 SQL> drop table test; Table dropped. 4、 準備復原到時間點T1,找回刪除的表,先關閉資料庫: SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down. 5、 拷貝剛才備份的所有資料檔案回來 C:\>copy D:\DATABAK\*.DBF D:\Oracle\ORADATA\TEST\ 6、 啟動到mount下 SQL> startup mount; Oracle instance started. Total System Global Area 102020364 bytes Fixed Size 70924 bytes Variable Size 85487616 bytes Database Buffers 16384000 bytes Redo Buffers 77824 bytes Database mounted. 7、 開始不完全復原資料庫到T1時間 SQL> recover database until time '2003-05-21:14:43:01'; ORA-00279: change 30944 generated at 05/21/2003 14:40:06 needed for thread 1 ORA-00289: suggestion : D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00191.ARC ORA-00280: change 30944 for thread 1 is in sequence #191 Specify log: {=suggested | filename | AUTO | CANCEL} auto Log applied. Media recovery complete. 8、 打開資料庫,檢查資料 SQL> alter database open resetlogs; Database altered. SQL> select * from test; A --------------------------------------- 1 2 說明: 1、不完全復原最好備份所有的資料,冷備份亦可,因為復原過程是從備份點往後復原的,如果因為其中一個資料檔案的時間戳(SCN)大於要復原的時間點,那麼復原都是不可能成功的; 2、不完全復原有三種方式,過程都一樣,僅僅是recover命令有所不一樣,這裏用基於時間的復原作為範例; 3、不完全復原之後,都必須用resetlogs的方式打開資料庫,建議馬上再做一次全備份,因為resetlogs之後再用以前的備份復原是很難了; 4、以上是在刪除之前獲得時間,但是實際應用中,很難知道刪除之前的實際時間,但可以採用大致時間即可,或可以採用分析日誌檔(logmnr),取得精確的需要復原的時間; 5、一般都是在測試機後備用機器上採用這種不完全復原,復原之後導出/導入被誤刪的表回生產系統. 4.4.2 RMAN備份下的基於改變的復原以上用OS備份說明了一個基於時間的復原,現在用RMAN說明一個基於改變的復原 1、 連接資料庫,建立測試表並插入記錄 SQL> connect internal/password as sysdba; Connected. SQL> create table test(a int); Table created SQL> insert into test values(1); 1 row inserted SQL> commit; Commit complete 2、 備份資料庫 C:\>rman Recovery Manager: Release 8.1.6.0.0 - Production RMAN> connect rcvcat rman/rman@back RMAN-06008: connected to recovery catalog database RMAN> connect target internal/virpure RMAN-06005: connected to target database: TEST (DBID=874705288) RMAN> run{ 2> allocate channel c1 type disk; 3> backup full tag 'dbfull' format 'd:\backup\full%u_%s_%p' database 4> include current controlfile; 5> sql 'alter system archive log current'; 6> release channel c1; 7> } //螢幕輸出內容冗長,省略--編輯 RMAN> 3、 刪除測試表,在刪除之前,便於測試,繼續插入資料並應用到歸檔,並獲取刪除前的scn號。 SQL> insert into test values(2); 1 row inserted SQL> commit; Commit complete SQL> select * from test; A --------------------------------------- 1 2 SQL> alter system switch logfile; Statement processed. SQL> alter system switch logfile; Statement processed. SQL> select max(ktuxescnw * power(2, 32) + ktuxescnb) scn from x$ktuxe; SCN ---------- 31014 SQL> drop table test; Table dropped. 4、 準備復原到SCN 31014,先關閉資料庫,然後啟動到mount下 SQL> shutdown immediate; Database closed. Database dismounted. Oracle instance shut down. SQL> startup mount; 5、 開始復原到改變點SCN 31014 RMAN> run{ 2> allocate channel c1 type disk; 3> restore database; 4> recover database until scn 31014; 5> sql 'ALTER DATABASE OPEN RESETLOGS'; 6> release channel c1; 7> } RMAN-03022: compiling command: allocate RMAN-03023: executing command: allocate RMAN-08030: allocated channel: c1 RMAN-08500: channel c1: sid=10 devtype=DISK RMAN-03022: compiling command: restore RMAN-03022: compiling command: IRESTORE RMAN-03023: executing command: IRESTORE RMAN-08016: channel c1: starting datafile backupset restore RMAN-08502: set_count=1 set_stamp=494613682 creation_time=21-MAY-03 RMAN-08089: channel c1: specifying datafile(s) to restore from backup set RMAN-08523: restoring datafile 00001 to D:\Oracle\ORADATA\TEST\SYSTEM01.DBF RMAN-08523: restoring datafile 00002 to D:\Oracle\ORADATA\TEST\RBS01.DBF RMAN-08523: restoring datafile 00003 to D:\Oracle\ORADATA\TEST\USERS01.DBF RMAN-08523: restoring datafile 00004 to D:\Oracle\ORADATA\TEST\TEMP01.DBF RMAN-08523: restoring datafile 00005 to D:\Oracle\ORADATA\TEST\TOOLS01.DBF RMAN-08523: restoring datafile 00006 to D:\Oracle\ORADATA\TEST\INDX01.DBF RMAN-08023: channel c1: restored backup piece 1 RMAN-08511: piece handle=D:\BACKUP\FULL01ENMD5I_1_1 tag=DBFULL params=NULL RMAN-08024: channel c1: restore complete RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-03022: compiling command: recover RMAN-03022: compiling command: recover(1) RMAN-03022: compiling command: recover(2) RMAN-03022: compiling command: recover(3) RMAN-03023: executing command: recover(3) RMAN-08054: starting media recovery RMAN-03022: compiling command: recover(4) RMAN-06050: archivelog thread 1 sequence 191 is already on disk as file D:\ORACL E\ORADATA\TEST\ARCHIVE\TESTT001S00191.ARC RMAN-06050: archivelog thread 1 sequence 192 is already on disk as file D:\ORACL E\ORADATA\TEST\ARCHIVE\TESTT001S00192.ARC RMAN-03023: executing command: recover(4) RMAN-08515: archivelog filename=D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00191.AR C thread=1 sequence=191 RMAN-08515:archivelog filename=D:\Oracle\ORADATA\TEST\ARCHIVE\TESTT001S00192.ARC Thread=1 sequence=192 RMAN-08055: media recovery complete RMAN-03022: compiling command: sql RMAN-06162: sql statement: ALTER DATABASE OPEN RESETLOGS RMAN-03023: executing command: sql RMAN-03022: compiling command: release RMAN-03023: executing command: release RMAN-08031: released channel: c1 6、 檢查資料 Database altered. SQL> select * from test; A --------------------------------------- 1 2 可以看到,表依然存在。 說明: 1、 RMAN也可以實現不完全復原,方法比OS備份復原的方法更簡單可靠; 2、 RMAN可以基於時間,基於改變與基於日誌序列的不完全復原,基於日誌序列的復原可以指定復原到哪個日誌序列,如 run { allocate channel ch1 type disk; allocate channel ch2 type 'sbt_tape'; set until logseq 1234 thread 1; restore controlfile to '$Oracle_HOME/dbs/cf1.f' ; replicate controlfile from '$Oracle_HOME/dbs/cf1.f'; alter database mount; restore database; recover database; sql "ALTER DATABASE OPEN RESETLOGS"; } 3、 與所有的不完全復原一樣,必須在mount下,restore所有備份資料檔案,需要resetlogs; 4、 基於改變的復原比基於時間的復原更可靠,但是可能也更複雜,需要知道需要復原到哪一個改變號(SCN),在正常生產中,獲取SCN的辦法其實也有很多,如查詢資料庫字典表(V$archived_log or v$log_history),或分析歸檔與上線日誌(logmnr)等。 第五章 其他復原案例 5.1 損壞上線日誌的復原方法 5.1.1 損壞非當前上線日誌大家都清楚,上線日誌分為當前上線日誌和非當前上線日誌,非當前上線日誌的損壞是比較簡單的,一般通過clear命令就可以解決問題。 1、啟動資料庫,遇到ORA-00312 or ORA-00313錯誤,如 ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: 'D:\Oracle\ORADATA\TEST\REDO01.LOG' 從這裏我們知道日誌組1的資料檔案損壞了從警報檔可以看到更詳細的資訊 2、 查看V$log視觀表 SQL> select group#,sequence#,archived,status from v$log; GROUP# SEQUENCE# ARCHIVED STATUS ---------- ---------- -------- ---------------- 1 1 YES INACTIVE 2 2 YES INACTIVE 3 3 NO CURRENT 可以知道,該組是非當前狀態,而且已經歸檔。 3、 用CLEAR命令重建該日誌檔 SQL>alter database clear logfile group 1; 如果是該日誌組還沒有歸檔,則需要用 SQL>alter database clear unarchived logfile group 1; 4、 打開資料庫,重新備份資料庫 SQL>alter database open; 說明: 1、如果損壞的是非當前的上線日誌檔,一般只需要clear就可以重建該日誌檔,但是如果該資料庫處於歸檔狀態但該日誌還沒有歸檔,就需要強行clear; 2、建議clear,特別是強行clear後作一次資料庫的全備份; 3、此方法適用於歸檔與非歸檔資料庫。 5.1.2 損壞當前上線日誌 歸檔模式下當前日誌的損壞有兩種情況,一、是資料庫是正常關閉,日誌檔中沒有未決的事務需要實例復原,當前日誌組的損 壞就可以直接用alter database clear unarchived logfile group n來重建。二、是日誌組中有活動的事務,資料庫需要媒體復原,日誌組需要用來同步,有兩種補救辦法: A. 最好的辦法就是通過不完全復原,可以保證資料庫的一致性,但是這種辦法要求在歸檔方式下,並且有可用的備份 B. 通過強制性復原,但是可能導致資料庫不一致。 下面分別用來說明這兩種復原方法: 5.1.2.1 通過備份來復原 1、 打開資料庫,會遇到一個類似的錯誤 ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: 'D:\Oracle\ORADATA\TEST\REDO01.LOG' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔 2、 查看V$log,發現是當前日誌 SQL> select group#,sequence#,archived,status from v$log; GROUP# SEQUENCE# ARCHIVED STATUS --------- ---------- -------- ---------------- 1 1 NO CURRENT 2 2 YES INACTIVE 3 3 YES INACTIVE 3、 發現clear不成功 SQL> alter database clear unarchived logfile group 1; alter database clear unarchived logfile group 1 * ERROR at line 1: ORA-01624: log 1 needed for crash recovery of thread 1 ORA-00312: online log 1 thread 1: 'D:\Oracle\ORADATA\TEST\REDO01.LOG' 4、 拷貝有效的資料庫的全備份,並不完全復原資料庫:可以採用獲取最近的SCN的辦法用until scn復原或用until cnacel復原 recover database until cancel 先選擇auto,儘量復原可以利用的歸檔日誌,然後重新 recover database until cancel 這次輸入cancel,完成不完全復原,也就是說復原兩次。如: SQL> recover database until cancel; Auto …… SQL> recover database until cancel; Cancel; 5、 利用alter database open resetlogs打開資料庫. 說明: 1、這種辦法復原的資料庫是一致的不完全復原,會丟失當前上線日誌中的事務資料; 2、這種方法適合於歸檔資料庫並且有可用的資料庫全備份; 3、復原成功之後,記得再做一次資料庫的全備份; 4、建議上線日誌檔一定要實現鏡相在不同的磁片上,避免這種情況的發生,因為任何資料的丟失對於生產來說都是不容許的。 5.1.2.2 如果沒有備份,進行強制性復原 1、 打開資料庫,會遇到一個類似的錯誤 ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: 'D:\Oracle\ORADATA\TEST\REDO01.LOG' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔 2、 查看V$log,發現是當前日誌 SQL> select group#,sequence#,archived,status from v$log; GROUP# SEQUENCE# ARCHIVED STATUS ---------- ---------- -------- ---------------- 1 1 NO CURRENT 2 2 YES INACTIVE 3 3 YES INACTIVE 3、 發現clear不成功 SQL> alter database clear unarchived logfile group 1; alter database clear unarchived logfile group 1 * ERROR at line 1: ORA-01624: log 1 needed for crash recovery of thread 1 ORA-00312: online log 1 thread 1: 'D:\Oracle\ORADATA\TEST\REDO01.LOG' 4、 把資料庫down掉 SQL>shutdown immediate 5、 在init.ora中加入如下參數 _allow_resetlogs_corruption=TRUE 6、 重新啟動資料庫,利用until cancel復原 SQL>recover database until cancel; Cancel 如果出錯,不再理會,發出 SQL>alter database open resetlogs; 7、 資料庫被打開後,馬上執行一個full export 8、 shutdown資料庫,去掉_all_resetlogs_corrupt參數 9、 重建庫 10、import並完成復原 11、建議執行一下ANALYZE TABLE ...VALIDATE STRUCTURE CASCADE; 說明: 1、該復原方法是沒有辦法之後的復原方法,一般情況下建議不要採用,因為該方法可能導致資料庫的不一致; 2、該方法也丟失資料,但是丟失的資料沒有上一種方法的資料多,主要是未寫入資料檔案的已提交或未提交資料; 3、建議成功後嚴格執行以上的7到11步,完成資料庫的檢查與分析; 4、全部完成後做一次資料庫的全備份; 5、建議上線日誌檔一定要實現鏡相在不同的磁片上,避免這種情況的發生,因為任何資料的丟失對於生產來說都是不容許的。 5.2 損壞控制檔的復原方法 5.2.1 損壞單個控制文件損壞單個控制檔是比較容易復原的,因為一般的資料庫系統,控制檔都不是一個,而且所有的控制檔都互為鏡相,只要拷貝一個好的控制檔替換壞的控制檔就可以了。 1、 控制檔損壞,最典型的就是啟動資料庫出錯,不能mount資料庫 SQL>startup ORA-00205: error in identifying controlfile, check alert log for more info 查看警報日誌檔,有如下資訊 alter database mount Mon May 26 11:59:52 2003 ORA-00202: controlfile: 'D:\Oracle\oradata\chen\control01.ctl' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 2、 停止資料庫: SQL>shutdown immediate 3、 拷貝一個好的控制檔替換壞的控制檔或修改init.ora中的控制檔參數,取消這個壞的控制檔。 4、 重新啟動數據: SQL>startup 說明: 1、損失單個控制檔是比較簡單的,因為資料庫中所有的控制檔都是鏡相的,只需要簡單的拷貝一個好的就可以了; 2、建議鏡相控制檔在不同的磁片上; 3、建議多做控制檔的備份,長期保留一份由alter database backup control file to trace產生的控制檔的文本備份。 5.2.2 損壞全部控制檔 損壞多個控制檔,或者人為的刪除了所有的控制檔,通過控制檔的複製已經不能解決問題,這個時候需要重新建立控制檔。 同時注意,alter database backup control file to trace可以產生一個控制檔的文本備份。 以下是詳細重新建立控制檔的步驟: 1、 關閉資料庫 SQL>shutdown immediate; 2、 刪除所有控制檔,模擬控制檔的丟失 3、 啟動資料庫,出現錯誤,並不能啟動到mount下 SQL>startup ORA-00205: error in identifying controlfile, check alert log for more info 查看警報日誌檔,有如下資訊 alter database mount Mon May 26 11:53:15 2003 ORA-00202: controlfile: 'D:\Oracle\oradata\chen\control01.ctl' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) 系統找不到指定的檔。 4、 關閉資料庫 SQL>shutdown immediate; 5、 在internal或sys下運行如下建立控制檔的腳本,注意完整列出上線日誌或資料檔案的路徑,或修改由alter database backup control file to trace備份控制檔時產生的腳本,去掉多餘的注釋即可。 STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGS NOARCHIVELOG MAXLOGFILES 32 MAXLOGMEMBERS 2 MAXDATAFILES 254 MAXINSTANCES 1 MAXLOGHISTORY 226 LOGFILE GROUP 1 'D:\Oracle\ORADATA\TEST\REDO01.LOG' SIZE 1M, GROUP 2 'D:\Oracle\ORADATA\TEST\REDO02.LOG' SIZE 1M, GROUP 3 'D:\Oracle\ORADATA\TEST\REDO03.LOG' SIZE 1M DATAFILE 'D:\Oracle\ORADATA\TEST\SYSTEM01.DBF', 'D:\Oracle\ORADATA\TEST\RBS01.DBF', 'D:\Oracle\ORADATA\TEST\USERS01.DBF', 'D:\Oracle\ORADATA\TEST\TEMP01.DBF', 'D:\Oracle\ORADATA\TEST\TOOLS01.DBF', 'D:\Oracle\ORADATA\TEST\INDX01.DBF' CHARACTER SET ZHS16GBK; -- Recovery is required if any of the datafiles are restored backups, -- or if the last shutdown was not normal or immediate. RECOVER DATABASE --if the last shutdown was not normal or immediate --noarchive -- RECOVER DATABASE UNTIL CANCELUSING BACKUP CONTROLFILE --archive -- RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL -- Database can now be opened normally. ALTER DATABASE OPEN; --if recover database until cancel --ALTER DATABASE OPEN RESETLOGS; 6、 如果沒有錯誤,資料庫將啟動到open狀態下。 說明: 1、重建控制檔用於復原全部資料檔案的損壞,需要注意其書寫的正確性,保證包含了所有的資料檔案與上線日誌; 2、經常有這樣一種情況,因為一個磁片損壞,我們不能再復原(store)資料檔案到這個磁片,因此在store到另外一個盤的時候,我們就必須重新建立控制檔,用於識別這個新的資料檔案,這裏也可以用這種方法用於復原。 5.3 損壞回滾資料檔案的復原方法 回滾段表空間中的一個資料檔案丟失或者損壞導致資料庫無法識別它,在啟動資料庫的時候會出現ORA-1157, ORA-1110的錯誤,或者作業系統級別的錯誤,例如ORA-7360。在關閉資料庫的時候(normal或者immediate)會出現ORA-1116, ORA-1110的錯誤,或者作業系統級別的錯誤,例如ORA-7368。 感謝Coolyl的辛勤工作,關於回滾段的大部分內容都是摘自他在itpub的文章。 5.3.1 損壞資料檔案,但資料庫處於Open狀態如果你發現有回滾段的資料檔案丟失或者損壞了,而此時的資料庫是處於打開的狀態下並且在運行,就千萬不要關閉資料庫了,因為在大多數的情況下打開的時候比關閉的時候好解決問題一些。 一般也是存在有兩種情況: A、是offline丟失或損壞的資料檔案,然後從一個備份中復原,執行介質復原以保持一致性。但是這種情況要求資料庫是歸檔方式下才可以採用的。 B、是offline那個存在丟失或損壞的資料檔案所在的整個回滾段表空間,然後刪除整個回滾段表空間並重建,但是你必須要殺掉那些在回滾段中已經啟動的用戶執行序才可以offline的。 通常第一種情況就比較簡單實現,但是更多的用戶事務將會出錯並且回滾。 A的具體步驟: 1、 offline丟失或損壞的資料檔案 ALTER DATABASE DATAFILE '' OFFLINE; 2、 從一個有效的備份中復原。 3、 執行以下查詢: SELECT V1.GROUP#, MEMBER, SEQUENCE# FROM V$LOG V1, V$LOGFILE V2 WHERE V1.GROUP# = V2.GROUP# ; 這個將列出你的所有redolog檔以及它們所代表的sequence numbers。 4、 復原資料檔案。 RECOVER DATAFILE '' 5、 確信你應用了所有的redolog檔,直至出現提示資訊"Media recovery complete"。 6、 online那個資料檔案。 ALTER DATABASE DATAFILE '' ONLINE; B的具體步驟: 1、 offline存在丟失或損壞的資料檔案的回滾段表空間中的所有回滾段。 ALTER ROLLBACK SEGMENT OFFLINE; 2、 檢測當然回滾段的狀態。 SELECT SEGMENT_NAME, STATUS FROM DBA_ROLLBACK_SEGS WHERE TABLESPACE_NAME = ''; 3、 刪除所有offline的回滾段 DROP ROLLBACK SEGMENT ; 4、 處理那些online狀態的回滾段。 重新執行第二步的查詢 如果你已經執行過offline操作的回滾段狀態仍然是online,則說明這個回滾段內有活動的事務。你要接著查詢 SELECT SEGMENT_NAME, XACTS ACTIVE_TX, V.STATUS FROM V$ROLLSTAT V, DBA_ROLLBACK_SEGS WHERE TABLESPACE_NAME = '' AND SEGMENT_ID = USN; 如果沒有返回結果,則證明存在丟失或損壞的資料檔案的回滾段表空間中的所有回滾段都已經被offline了,然後重新執行第二步,第三步。如果查詢有結果返回,則狀態應該是"PENDING OFFLINE".接著查看ACTIVE_TX列,如果值為0,則表明此回滾段中已經沒有未處理的事務了,很快就會被offline的,然後等它offline後重新執行2,3步後跳至第六步。如果值大於0,則繼續到第五步。 5、 強制那些包含活動事務的回滾段offline。 活動的事務應該被提交或者回滾,執行下面的查詢看看哪些用戶佔用了回滾段: SELECT S.SID, S.SERIAL#, S.USERNAME, R.NAME "ROLLBACK" FROM V$SESSION S, V$TRANSACTION T, V$ROLLNAME R WHERE R.NAME IN ('', ... , '') AND S.TADDR = T.ADDR AND T.XIDUSN = R.USN; 最好能直接聯繫到那些user讓他們自己去回滾或者提交事務,如果不能做到的話,那就只能強制性的殺掉執行序了。 ALTER SYSTEM KILL SESSION ', '; 殺掉執行序後再過一段時間後回滾段會自動清除那些事務,然後就可以回到第二步繼續查詢了。 6、 刪除回滾段。 DROP TABLESPACE INCLUDING CONTENTS; 7、 重建回滾段並online它們。 說明: 1、資料庫如果是open狀態,就可以直接在open狀態下解決問題,沒有必要停下資料庫,增加down機時間; 2、不管上上面那種復原方法都是正常性的復原,不會引起資料的不一致或錯誤。 5.3.2資料庫關閉,但是資料檔案中沒有活動事務 這種情況下最簡單的方法就是offline drop掉這個壞了的或者丟失的資料檔案,然後以restricted模式打開資料庫然後刪除並且重建包含損壞檔的回滾段表空間。 具體步驟如下: 1、 確定資料庫是正常的關閉的。方法是可以去查看alert檔,到最後看是否有如下資訊: "alter database dismount Completed: alter database dismount" 如果有的話,就證明資料庫是正常關閉的,否則就不能用這個方法去復原。 2、 修改init參數檔,移去ROLLBACK_SEGMENTS中包含的損壞資料檔案的回滾段表空間的回滾段,如果你不能確定哪些回滾段是壞的,簡單的方法是你可以注釋掉整個ROLLBACK_SEGMENTS。 3、 以restricted模式去mount資料庫。 STARTUP RESTRICT MOUNT 4、 offline drop掉那個壞的資料檔案 ALTER DATABASE DATAFILE '' OFFLINE DROP; 5、 打開資料庫 ALTER DATABASE OPEN 如果你看到如下資訊"Statement processed",則跳到第7步,如果你看到ORA-604, ORA-376, and ORA-1110的錯誤資訊,繼續第6步。 6、 正常的關閉資料庫,然後在init檔中注釋掉ROLLBACK_SEGMENTS,並加入隱含參數 _corrupted_rollback_segments = ( ,...., ) 然後以restricted模式打開資料庫 STARTUP RESTRICT 7、 刪除掉那個包含損壞檔的回滾段表空間。 DROP TABLESPACE INCLUDING CONTENTS; 8、 重建回滾段表空間,記得建立後要把回滾段都online。 9、 重新使資料庫對所有用戶可用。 ALTER SYSTEM DISABLE RESTRICTED SESSION; 10、然後正常關閉資料庫,修改init檔,如果開始只是注釋掉了ROLLBACK_SEGMENTS的,就去掉注釋即可,如果加了隱含參數的,注釋掉它,並在ROLLBACK_SEGMENTS加入所有的回滾段。 11、正常啟動資料庫: Startup 說明: 1、這種方法的前提條件是資料庫是正常關閉(不是abort)可用; 2、這種方法是正常方法,不會引起資料錯誤。 5.3.3 資料庫關閉,資料檔案中有活動事務,沒有可用備份。一般造成這種原因的情況是採用了shutdown abort或其他原因異常關機(如斷電)導致的。 1、開啟一個事務 SQL> set transaction use rollback segment rbs0; Transaction set. SQL> insert into test (a) values (1); 1 row created. 2、異常關閉 SQL> shutdown abort; Oracle instance shut down. 3、刪除rbs的一個資料檔案 C:>del D:\Oracle\oradata\chen\rbs01. 4、修改INIT.ora : rollback_segments=(system) 添加_corrupted_rollback_segments=(rbs0,rbs1,rbs2……) 5、SQL>Startup mount 6、SQL>alter database datafile 'd:\Oracle\oradata\t8i\rbs01.dbf' offline drop; 資料庫已更改。 7、SQL>recover database ; 完成介質復原。 8、SQL>alter database open ; 資料庫已更改。 9、SQL>select * from v$rollname; USN NAME ---- ------- 0 SYSTEM 10、SQL>select segment_name,tablespace_name,status FROM dba_rollback_segs; SEGMENT_NAME TABLESPACE_NAME STATUS ----------- ------ ------------------------------------ SYSTEM SYSTEM ONLINE RBS0 RBS NEEDS RECOVERY RBS1 RBS NEEDS RECOVERY RBS2 RBS NEEDS RECOVERY 11、SQL>drop rollback segment rbs0; 重算段已丟棄。 SQL>drop rollback segment rbs1; 重算段已丟棄。 SQL>drop rollback segment rbs2; 重算段已丟棄。 12、SQL>select segment_name,tablespace_name,status FROM dba_rollback_segs; SEGMENT_NAME TABLESPACE_NAME STATUS ------------------------------------- SYSTEM SYSTEM ONLINE 13、SQL>drop tablespace rbs including contents; 表空間已丟棄。 14、重建新的回滾表空間及回滾段,並上線。 15、SQL>shutdown abort 16、再修改INIT.ora : rollback_segments=(rbs0,rbs1,rbs2) 將_corrupted_rollback_segments=(rbs0,rbs1,rbs2)去掉。 17、SQL>startup 說明: 1、這種辦法是萬不得以的時候使用的方法,如果有備份,都建議從備份上進行復原; 2、這種方法復原的資料庫,可能會引起資料庫的資料錯誤; 3、復原成功以後,建議exp/imp資料,並重新分析檢查資料庫。 5.3.4 資料庫關閉,資料檔案中有活動事務,從備份復原 1、從一個有效的備份中復原損壞的資料檔案。 2、mount資料庫。 3、執行以下查詢: SELECT FILE#, NAME, STATUS FROM V$DATAFILE; 如果發現要復原的檔是offline狀態的話,要先online它: ALTER DATABASE DATAFILE '' ONLINE; 4、執行以下查詢 SELECT V1.GROUP#, MEMBER, SEQUENCE#, FIRST_CHANGE# FROM V$LOG V1, V$LOGFILE V2 WHERE V1.GROUP# = V2.GROUP# ; 這個將列出redlog檔所代表的sequence和first change numbers。 5、如果資料庫是非歸檔情況下,執行以下查詢: SELECT FILE#, CHANGE# FROM V$RECOVER_FILE; 如果CHANGE#大於最小的redolog檔的FIRST_CHANGE#,則資料檔案可以被復原,記得在應用日誌的時候要把所有redolog檔全部應用一遍。 如果CHANGE#小於最小的redolog檔的FIRST_CHANGE#,則資料檔案就不可以被復原了,這時候你要從一個有效的全備份中去復原資料庫了,如果沒有全備份的話,那你就只能把資料庫強制打開到一個不一致的狀態去exp出資料,然後重新建庫導入資料,因為這種方式的復原Oracle是不推薦用戶自己做的,所以這裏我就不詳細說明了。 6、復原資料檔案: RECOVER DATAFILE '' 7、確信你應用了所有的redolog檔,直至出現提示資訊"Media recovery complete"。 8、打開資料庫。 說明: 1、這種方法要求在歸檔有備份的方式下進行,而且是建議方式; 2、這種方法不會導致資料庫的錯誤。 5.4 損壞臨時資料檔案的復原方法 臨時資料檔案的復原是比較簡單的,因為暫存檔案中不涉及到其他的有用的資料,所以可以刪除後重建。 1、關閉資料庫: SQL>shutdown immediate 2、刪除臨時資料檔案,模擬媒體失敗; 3、啟動資料庫,檢測到檔錯誤; 4、離線該資料檔案: SQL>alter database datafile '檔案名全名' offline drop; 5、打開資料庫 SQL>alter database open 6、刪除該臨時表空間 SQL>drop tablespace temp(或其他臨時表空間名稱); 7、重新建立該表空間,並重新分配給用戶。 說明: 1、臨時資料檔案是非重要檔,不保存永久資料,可以隨時刪除重建,不影響資料庫的資料安全; 2、如果重新建立以後,別忘了重新分配給用戶。 第六章. 常見復原誤區 1、可以不需要備份,只有歸檔就能進行資料庫的向前的復原 答:這個在Oracle 9i以前起碼是不可能的,在別的資料庫我也沒有聽說過,不完全復原的主要思路是利用不完全點之前的備份,加上歸檔日誌,復原到不完全復原點,9i中出現了一個flashback的特性,這個特性的使用,也是有很多局限的。 2、進行不完全復原只需要拷貝一個需要復原的備份資料檔案答:不完全復原需要拷貝所有的資料檔案,最好包括臨時資料檔案在內,否則需要另外的處理,如果有一個資料檔案的SCN大於不完全復原點,那麼這個復原都將是失敗的。 3、使用RMAN目錄與目標資料庫在同一資料庫能很好進行資料庫的復原答:使用復原目錄與目標資料庫在同一個資料庫中,將存在很大的復原局限,如該資料庫的系統資料檔案的損害,資料庫根本不能open,那麼RMAN也就無法連接復原目錄,也就不存在復原了。 第七章. 小結 這裏我們反復示範了多種情況下的復原方案,通過這些示範,我們應該掌握了如下內容: 1、利用OS與RMAN進行各種常規備份與復原。 2、熟悉沒有備份或簡單的非常規備份與復原的方法。 |
|
|