如何快速安全的更改表的owner
前两天有人问我这个问题,我说你先自己去搜索下答案吧。
后来他说没有找到合适的方法,我搜索了一下,竟然发现没有人提到exchange partition的方法。
exchange partition的方法是最安全,也是最快速的方法。
所以这里写出这种方法供大家参考。
假设有A,B两个用户,我们想把TEST表从A用户移到B用户。
我们以非分区表作为例子:
SQL> conn a/a
Connected.
SQL> create table test(x int);Table created.
SQL> create index test_idx on test(x);
Index created.
SQL> insert into test select rownum from dual connect by level <10000;
9999 rows created.
SQL> commit;
Commit complete.
SQL> conn b/b
Connected.SQL> create table temp(x int) partition by range (x)
2 (partition part0 values less than (-1),
3 partition part1 values less than (maxvalue));Table created.
SQL> create table test(x int);
Table created.
SQL> create index temp_idx on temp(x) local;
Index created.
SQL> create index test_idx on test(x);
Index created.
SQL> alter table temp exchange partition part1 with table a.test including indexes without validation;
Table altered.
SQL> alter table temp exchange partition part1 with table test including indexes without validation;
Table altered.
SQL> select count(*) from a.test;
COUNT(*)
----------
0SQL> select count(*) from b.test;
COUNT(*)
----------
9999
如果是分区表,操作过程如下:
SQL> conn a/a
Connected.SQL> create table test(x int) partition by range (x)
2 (partition part0 values less than (100),
3 partition part1 values less than (maxvalue));Table created.
SQL> create index test_idx on test(x) local;
Index created.
SQL> insert into test select rownum from dual connect by level <1000;
999 rows created.
SQL> commit;
Commit complete.
SQL> conn b/b
Connected.
SQL> create table temp(x int);Table created.
SQL> create index temp_idx on temp(x);
Index created.
SQL> create table test(x int) partition by range (x)
2 (partition part0 values less than (100),
3 partition part1 values less than (maxvalue));Table created.
SQL> create index test_idx on test(x) local;
Index created.
SQL> select count(*) from a.test;
COUNT(*)
----------
999SQL> select count(*) from b.test;
COUNT(*)
----------
0SQL> alter table a.test exchange partition part0 with table temp including indexes without validation;
Table altered.
SQL> alter table test exchange partition part0 with table temp including indexes without validation;
Table altered.
SQL> select count(*) from a.test;
COUNT(*)
----------
900SQL> select count(*) from b.test;
COUNT(*)
----------
99SQL> alter table a.test exchange partition part1 with table temp including indexes without validation;
Table altered.
SQL> alter table test exchange partition part1 with table temp including indexes without validation;
Table altered.
SQL> select count(*) from a.test;
COUNT(*)
----------
0SQL> select count(*) from b.test;
COUNT(*)
----------
999
复合分区表的情况大同小异,大家可以自己试验一下。
Although these poofier hurdles of atrial fibliration and stroke with coumadin are steadier beutiful to depress the sorry hepatocytes harbored with heritable clindamycin, the weakend of these and noticable instances cannot toss stupified presently.
excellent submit, very informative. I wonder why the other specialists of this sector don’t notice this. You should continue your writing. I’m sure, you have a great readers’ base already!
In order to vie, corporations begin his / her search engine marketing having pay-per-click advertising software programs, just like Pay per click. While this can frequently give you superb preliminary benefits, the charges to be able to Bing and google really are unrecoverable expense, which unfortunately reduce sales and profits month after month.
Great – I should certainly pronounce, impressed with your site. I had no trouble navigating through all the tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, site theme . a tones way for your customer to communicate. Excellent task.
Hey! That’s a really great post. I’m very sure I will suggest it to my co-workers.In the event you post extra posts please e mail them to me.
I¡¦m not sure where you’re getting your information, however great topic. I must spend a while finding out more or understanding more. Thank you for wonderful info I was searching for this information for my mission.
I want to express thanks to this writer just for rescuing me from this circumstance. Right after looking throughout the internet and obtaining notions which are not productive, I figured my entire life was gone. Being alive without the approaches to the issues you have fixed through your good article content is a serious case, and those that might have in a wrong way damaged my career if I had not come across the website. Your personal natural talent and kindness in handling the whole thing was useful. I’m not sure what I would have done if I had not discovered such a solution like this. I’m able to at this point look forward to my future. Thanks for your time very much for your specialized and result oriented help. I will not think twice to endorse the website to any individual who needs and wants assistance about this situation.
I believe other sorts of web site creators should probably take a look at this valuable web-site as an example. Seriously clean and user friendly design, and in many cases fantastic material! You’re a guru operating in this amazing issue
In line with my study, after a in foreclosure home is marketed at an auction, it is common to the borrower to still have the remaining balance on the loan. There are many loan merchants who seek to have all costs and liens paid by the following buyer. However, depending on certain programs, legislation, and state regulations there may be some loans which are not easily handled through the shift of personal loans. Therefore, the obligation still rests on the customer that has got his or her property in foreclosure process. Many thanks sharing your thinking on this weblog.
Your weblog is astounding dude. i love to pay a visit to it daily. very nice layout and content ,
I really feel other homepage operators definitely should give consideration to this type of site as an example. Exceptionally clean and straightforward design and style, together with amazing posts! You’re an authority when it comes to this particular issue
Rattling instructive and superb complex body part of written content , now that’s user pleasant (:.
Your style is really unique compared to other people I have read stuff from. Many thanks for posting when you have the opportunity, Guess I’ll just book mark this web site.
Hiya very nice blog!! Guy .. Excellent .. Superb .. I will bookmark your website and take the feeds alsoˇKI am satisfied to find so many helpful information here within the publish, we need develop more techniques in this regard, thanks for sharing. . . . . .
I am no longer certain the place you’re getting your info, however great topic. I must spend a while studying more or figuring out more. Thank you for great information I was in search of this information for my mission.
I think this website holds some rattling superb info for everyone. “A man’s dreams are an index to his greatness.” by Zadok Rabinwitz.
Some genuinely prime posts on this internet site , bookmarked .
A person essentially help to make seriously articles I would state. This is the first time I frequented your website page and thus far? I surprised with the research you made to make this particular publish incredible. Fantastic job!
Thanks for the helpful content. It is also my opinion that mesothelioma cancer has an particularly long latency time, which means that symptoms of the disease won’t emerge till 30 to 50 years after the primary exposure to asbestos. Pleural mesothelioma, that is the most common kind and has an effect on the area about the lungs, will cause shortness of breath, breasts pains, plus a persistent cough, which may result in coughing up blood.
if the buffalo in my head could speak german i would not know a god damm thing. What i do know is that the language of art is out of this world.
This is the proper blog for anyone who desires to search out out about this topic. You notice so much its nearly hard to argue with you (not that I really would wantHaHa). You positively put a new spin on a topic thats been written about for years. Great stuff, just great!
Please let me know if you’re looking for a article author for your weblog. You have some really great articles and I feel I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please send me an e-mail if interested. Thank you!|Have you ever considered about adding a little bit more than just your articles? I mean, what you say is important and everything. However think about if you added some great photos or videos to give your posts more, “pop”! Your content is excellent but with pics and videos, this website could undeniably be one of the greatest in its niche. Good blog!|Neat blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your theme. Kudos|Hi would you mind stating which blog platform you’re using? I’m planning to start my own blog in the near future but I’m having a hard time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique. P.S My apologies for getting off-topic but I had to ask!|Hey there just wanted to give you a quick heads up. The text in your article seem to be running off the screen in Opera. I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d post to let you know. The design look great though! Hope you get the issue solved soon. Cheers|With havin so much content and articles do you ever run into any problems of plagorism or copyright violation? My blog has a lot of unique content I’ve either authored myself or outsourced but it appears a lot of it is popping it up all over the internet without my agreement. Do you know any ways to help protect against content from being stolen? I’d genuinely appreciate it.|Have you ever considered writing an ebook or guest authoring on other blogs? I have a blog based upon on the same subjects you discuss and would love to have you share some stories/information. I know my audience would value your work. If you are even remotely interested, feel free to shoot me an e-mail.|Hey! Someone in my Facebook group shared this site with us so I came to take a look. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Excellent blog and superb design.|Very good blog! Do you have any recommendations for aspiring writers? I’m hoping to start my own site soon but I’m a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely overwhelmed .. Any tips? Many thanks!|My coder is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the expenses. But he’s tryiong none the less. I’ve been using WordPress on a variety of websites for about a year and am worried about switching to another platform. I have heard excellent things about blogengine.net. Is there a way I can import all my wordpress content into it? Any help would be greatly appreciated!|Does your website have a contact page? I’m having trouble locating it but, I’d like to send you an email. I’ve got some recommendations for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it develop over time.|It’s a shame you don’t have a donate button! I’d certainly donate to this outstanding blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this blog with my Facebook group. Talk soon!|Greetings from California! I’m bored to tears at work so I decided to browse your blog on my iphone during lunch break. I really like the information you present here and can’t wait to take a look when I get home. I’m amazed at how quick your blog loaded on my cell phone .. I’m not even using WIFI, just 3G .. Anyhow, good site!|Hello there! I know this is kinda off topic however , I’d figured I’d ask. Would you be interested in exchanging links or maybe guest writing a blog post or vice-versa? My blog addresses a lot of the same topics as yours and I believe we could greatly benefit from each other. If you happen to be interested feel free to send me an email. I look forward to hearing from you! Excellent blog by the way!
Nice post. I study something tougher on different blogs everyday. It should all the time be stimulating to learn content material from different writers and follow a bit of one thing from their store. I’d favor to use some with the content on my weblog whether you don’t mind. Natually I’ll give you a hyperlink on your web blog. Thanks for sharing.
I am really loving the theme/design of your site. Do you ever run into any web browser compatibility problems? A couple of my blog audience have complained about my site not operating correctly in Explorer but looks great in Chrome. Do you have any tips to help fix this problem?|I’m curious to find out what blog platform you are using? I’m having some small security issues with my latest site and I would like to find something more secure. Do you have any recommendations?
This internet web site may possibly be a walk-through its the data you wanted in regards to this and didn’t know who should. Glimpse here, and you’ll absolutely discover it.
Can I say that of a relief to locate somebody that in fact knows what theyre talking about more than the internet. You surely know how to bring a challenge to light and produce it important. The diet ought to look at this and realize why side within the story. I cant believe youre not much more well-liked when you definitely offer the gift.
Howdy! This is my 1st comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading your posts. Can you recommend any other blogs/websites/forums that deal with the same topics? Thanks!
I blog quite often and I really thank you for your information. This article has truly peaked my interest. I will take a note of your blog and keep checking for new details about once per week. I subscribed to your RSS feed as well.
Howdy! This article couldn’t be written much better! Looking through this post reminds me of my previous roommate! He always kept talking about this. I will forward this post to him. Fairly certain he’ll have a great read. Many thanks for sharing!
This is the proper blog for anyone who wants to find out about this topic. You realize so much its almost onerous to argue with you (not that I actually would wantHaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!
Please forgive my English.Keep functioning ,impressive job!